postback

How to hide and display asp:buttons in asp.net from code behind?

别来无恙 提交于 2020-01-02 04:35:26
问题 I am working on asp.net web application. In one Page I have two asp buttons. I want to display them in one condition otherwise I don't want to display them. So I'm trying to do the same like this. But Its not working. I can't find the reason behind it. Please tell me where is the issue. To Hide Buttons if (!IsPostBack) { ButtonReplaceId.Style.Add("display", "none"); ButtonAssociateRules.Style.Add("display", "none"); } To display buttons protected void ApplyAssociation(object sender, EventArgs

ASP.NET custom control: when is LoadPostData() called?

与世无争的帅哥 提交于 2020-01-02 03:12:23
问题 I have developed a custom control that extends ListBox. The idea is that the control 'remembers' modifications to its elements which occurred client-side, e.g. as a result of an AJAX request. The way it works is that the control also renders a hidden input, and the result of the AJAX request is stored in the hidden input. This is posted back, and the control's LoadPostData() method looks for the hidden input, and if the hidden input has data, creates the ListItem collection from it. This

ASP.NET Ajax CalendarExtender will not update SelectedDate value

前提是你 提交于 2020-01-02 01:41:14
问题 For some reason, any CalendarExtenders on an ASP.NET site that is being worked on will not be updated. I have already checked all the obvious places (such as AutoPostBack and AutoEventHandler). The problem is that when I select a date from the Calendar and post it to the form, the TextBox that is being extended IS being updated, but the calendar extender's date is simply not being being updated (e.g. SelectedDate is still the same as before). I have googled for any possible solutions but none

IPostbackEventHandler VS IPostbackDataHandler

烈酒焚心 提交于 2020-01-01 10:07:33
问题 1) User selecting an item in DropDownList is considered to be postback data, and for that reason DropDownList implements IPostbackDataHandler . a) But why isn’t user moving ( in Calendar control ) to another month also considered a postback data? Thus, why does Calendar implement IPostbackEventHandler and not IPostbackDataHandler ? 2) a) I assume that controls implementing IPostbackEventHandler instead of IPostbackDataHandler never receive postback data? b) If control implements

OnClick events not working in ASP.NET page

只愿长相守 提交于 2020-01-01 07:22:44
问题 I am having a aspx page which inherits from a master page. In the master page I have a button that is common for every page in the solution. <div class="btn_general_mid"> <asp:Button ID="btnMainSearch" ValidationGroup="MainSearch" OnClientClick="CheckSearchTextBox()" CausesValidation="true" runat="server" OnClick="btnMainSearch_Click" CssClass="search_btn_submit" Text="Search" /> </div> Here the CheckSearchTextBox() is a javascript function and the btnMainSearch_Click is the event which is

jQuery call __doPostBack on LinkButton

旧城冷巷雨未停 提交于 2020-01-01 05:38:25
问题 I have a LinkButton that I need to perform a click on to cause a postback. The actual link target is: javascript:__doPostBack('ctl00$c1$btnRefreshGrid',''); Clicking the link does perform the postback, as verified by a breakpoint in the code-behind. Also pasting javascript:__doPostBack('ctl00$c1$btnRefreshGrid','') in the address bar of the browser works with the same effect. I've tried the following with no effect at all: __doPostBack('ctl00$c1$btnRefreshGrid',''); $('#ctl00$c1

OutputCache returns invalid version with PostBack

喜你入骨 提交于 2019-12-31 03:08:28
问题 I am having a weird issue happening with outputcache. I have multiple user controls on a page, one of which is a login control. The page and the login control is NOT cached, but other user controls are cached with VaryByParam. Now all of this works along with caching when I click on to different pages. But as soon as I login, other user controls on that page display old cached versions. If I refresh the page, I get the correct cached version of all user controls. The problem is only when a

Compare validator doesn't stop postback

…衆ロ難τιáo~ 提交于 2019-12-31 03:06:50
问题 Below is my mark up. <asp:TextBox ID="txtPatientDateOfBirth" runat="server" CssClass="rightDivInnerControls" ClientIDMode="Static" CausesValidation="True"> </asp:TextBox> <asp:CompareValidator ID="cvPatientDateOfBirth" runat="server" ErrorMessage="Enter proper date." Type="Date" ControlToValidate="txtPatientDateOfBirth" Font-Bold="True" Operator="DataTypeCheck" ValidationGroup="FirstPreview"> </asp:CompareValidator> <asp:Button ID="btnSaveChanges" runat="server" Text="Save Changes"

What is the difference between client browser's submit mechanism and the ASP.NET postback mechanism?

风流意气都作罢 提交于 2019-12-30 10:35:30
问题 Button.UseSubmitBehavior property is used to gets or sets a value indicating whether the Button control uses the client browser's submit mechanism or the ASP.NET postback mechanism. So, What is the difference between client browser's submit mechanism and the ASP.NET postback mechanism? 回答1: If you set use submit behavior to false, ASP.NET will generate script to handle submit by calling "__doPostBack" method like the following code. The method will add value to event target for telling server

What is the meaning of __doPostBack function, and when is it used?

谁说胖子不能爱 提交于 2019-12-30 10:06:54
问题 I had problem triggering server side button click events so I found a solution on the net that I should do something like <input type="submit" name="button" id="loginButton" value="Submit" class="button-orange" alt="Register" title="Register" runat = "server" onclick ="this.disabled=true;__doPostBack('loginButton','')"/> I did it, and it worked, but I would like to know what is going on! 回答1: simply said, it is used mainly by controls with AutoPostBack property http://www.dotnetspider.com