问题标签 [ispostback]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
46 浏览

c# - if (!IsPostBack) 不适用于第二种语言

我的页面中有 2 个表格。我可以在这两者之间进行选择,以选择语言。

在我的代码中,我有这个:

它正在工作。在这两种语言中,用户都可以插入到数据库中。使用主要语言,用户甚至可以知道他是否已经回答。虽然当我选择第二种语言时,我无法获得if (!IsPostBack)

如何修复我的代码?

0 投票
1 回答
2072 浏览

javascript - 如何从点击另一个页面的链接按钮调用按钮的点击事件而不在c#ASP.NET中回发

当我点击右上角的绿色按钮时,页面数据将保持原样。新窗口将打开另一个功能

点击链接按钮后,即左侧的`ApppointMentScheduler',我的数据会被刷掉

我有一个链接按钮LinkButtonmasterpage点击和点击,我正在重定向到,比如说Page1.aspx。在 Page1.aspx 上,我有一个button1. 点击那个button1,我打开新窗口,不影响Page1.aspx.

但是,当我单击LinkButton母版页,重定向到Page1.aspx后面的代码和从后面的代码中,单击button1时,Page1.aspx数据会发生变化。

如何防止这种情况。我正在提供我的代码。

母版页上的链接按钮:

点击 LinkBut​​ton 的事件:

重定向页面的PageLoad(PhoneMessage.aspx):

PhoneMessage.aspx 上的按钮:

RaisPostBackPhoneMessage.aspx 上的方法:

ps:当我点击的时候btnScheduleAppointmentsource会是Schedule Appointments,如果我点击lnkAppointMent, 即使我在点击的时候source也会是。<span>Appointment Scheduler </span>btnScheduleAppointmentlnkAppointMent

按钮的点击事件:

脚本 :

需要任何澄清。请评论。

0 投票
1 回答
76 浏览

c# - How can I display a Reset button on a form ony after the form has submitted?

After a form submits, it reverts to its original state (for the most part), and we want to have a "Reset" button that allows the user to start the page "afresh". I was hoping I could define and configure the HtmlButton in code:

...and then instantiate it only on postback (after the form has submitted) like so:

But the last line (where the button is added to the page's (this's) Controls), it fails with:

System.Web.HttpException was unhandled by user code Message=Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.
Source=System.Web ErrorCode=-2147467259 StackTrace: at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at DirectPaymentSectionsWebPart.DPSVisualWebPart.DPSVisualWebPartUserControl.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:

I also tried creating/configuring the HtmlButton at the beginning (when IsPostBack was false), by adding the control to "this" from the git-go, like this:

...and then hiding it via jQuery:

...but that also failed on the same line ("this.Controls.Add(btnStartNewDirPay);") in "CreateAndConfigureButtonStartNewDirectPayment()" with the same err msg as above, once IsPostBack is true.

So it won't allow me to instantiate and hide the HtmlButton at the beginning, and later show it when IsPostBack is true; Nor will it allow me to defer instantiation to when IsPostBack is true, it seems. Surely it's possible to have an element that displays after a postback but not prior to that...but how?

0 投票
1 回答
72 浏览

asp.net - Asp.Net 应用程序在点击后退按钮时保留查询信息

我有一个由其他人构建的网络工具。应用程序根据最终用户输入的搜索参数(例如“零件编号、零件状态等”)查询数据库。当用户点击搜索页面时,他们会看到一个简单的文本框以输入零件编号,以及一个使用 JavaScript 切换显示所有参数功能的按钮。如果用户使用一堆参数进行搜索,则会显示零件列表。如果用户单击零件,他们将被带到零件描述页面。

困境:当用户点击部件描述页面然后调用返回按钮时,他们会看到第一个初始搜索页面,而不是返回到部件列表。我希望将它们带回零件列表,而不是重置表格。

请参阅下面的代码示例(任何帮助将不胜感激):

CS链接:https ://drive.google.com/file/d/0B-cYAOqWVWFjUnJBeC1MTFZBcjA/view?usp=sharing

上传时间太长,不知道有没有其他方法。

0 投票
1 回答
1677 浏览

asp.net - IsPostBack 在 ASP.NET 中不起作用

我希望在第一次加载页面时,字符串 str 用文本“我在这里”进行初始化。当通过单击按钮 (btn_click) 更新页面时,该值与初始化的值相同。但它不起作用。在控制台中我读到:

第一次加载页面:“我在这里”

1.当我点击按钮时:“空”

2.我认为我们应该保持这个价值观:“我在这里”。请帮忙。

0 投票
0 回答
97 浏览

asp.net - ASP.Net 如何知道 IsPostBack 是真还是假?

当在服务器上请求页面并将响应发送回客户端时,我们倾向于理解客户端和服务器之间存在请求/响应关系,对于每个请求,都会生成一个新的请求/响应,而不是服务器如何知道, IsPostBack 在第一次或后续请求中是真/假?

0 投票
1 回答
45 浏览

c# - 我错过了明显的吗?我想我将不得不在这里使用 ispostback 但不了解如何

我正在尝试使用更新查询将文件路径插入 SQL Server。但是,尽管查询成功运行且没有错误,但我无法看到更改。这是我的 asp.net 网络应用程序的代码。我试图在我的数据库中的表列中插入流值,在本地机器上执行此操作,

我也可以在编译时看到值,文件也被保存到指定的文件夹,但是为什么数据库没有更新?它只取旧值吗?如何在 isPostback 中相应地实施更改?先感谢您 :)

0 投票
2 回答
558 浏览

c# - ASP.net C3 IF 条件是回发

任何人都可以向我解释这个条件的含义,提前谢谢。

0 投票
1 回答
75 浏览

c# - C# 页面字段未按预期填充

有人可以告诉我我做错了什么吗?我试图在页面加载时自动调用该方法,但是它不起作用。

0 投票
1 回答
42 浏览

asp.net - How to control dropdownlist auotpostback in asp.net?

I have a dropdownlist with autopostback and an update panel, it works correctly, but I have also other controls in my page with autopostback. What I need is to control when the page is autopostback but the dropdownlist is not autopostback do something, like this:

I can use this:

But I can´t do this:

So how can I do this? I hope my explanation has been helpful, thanks.