postback

ASP.NET Page with multiple custom controls implementing IPostBackEventHandler

ぃ、小莉子 提交于 2019-12-10 22:52:47
问题 I am having an ASP.Net Page which contains multiple controls which implement the IPostBackEventHandler interface. The SIMPLIFIED VERSION of the code is given below: public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Custom Control MyTextBox mytxt = new MyTextBox(); mytxt.ID = "mytxt"; mytxt.TextChange += mytxt_TextChange; this.Form.Controls.Add(mytxt); //Custom Control MyButton mybtn = new MyButton(); mybtn.ID = "mybtn"; mybtn.Click +

How to Get Source of postback

可紊 提交于 2019-12-10 20:23:08
问题 if (Page.IsPostBack) { //here I need to know which control causes the postback } Thanks 回答1: See this posting Get control name in Page_Load event which make the post back 回答2: Here is the code from link "marked as Answer"( Just pasting code here so that we can save readers time): private string getPostBackControlName() { Control control = null; //first we will check the "__EVENTTARGET" because if post back made by the controls //which used "_doPostBack" function also available in Request.Form

How to stop Telerik RadWindow from always reloading on the next PostBack

空扰寡人 提交于 2019-12-10 18:54:57
问题 I am invoking a RadWindow as a dialog in my web page. I am invoking from code-behind since I need to pass some parameters: radWindow1.NavigateUrl = url + "?England,Germany,France"; radWindow1.VisibleOnPageLoad = true; This works great, however it keeps reloading on each and every postback. How can I stop the RadWindow from reloading? I don't mind code-behind or JavaScript to achieve this. 回答1: You can use the IsPostBack property of the page to see if this is the first time it is loading or a

__doPostBack reloading entire page instead of just the UpdatePanel

久未见 提交于 2019-12-10 17:33:08
问题 In my javascript, I have the following line: __doPostBack('MyPanel', MyParam); In my code behind, I use MyParam to query a database and bind the result to a gridview that's inside the MyPanel updatepanel. The updatemode of the updatepanel is set to conditional and in the postback part of the code I have MyPanel.Update(); The updatepanel works fine when I'm doing sorting and paging; only the panel is refreshed. However, when I trigger the updatepanel with my javascript, I see the traffic in

FileUpload in FormView inside an UpdatePanel

我是研究僧i 提交于 2019-12-10 15:59:04
问题 The Scenario: I have an ASP.Net webpage which I intend to use for letting the user(not the real users, but content manager basically) insert and edit the records in a table using a FormView. This FormView is inside an UpdatePanel, as I'm also using cascading dropdownlists to let the user select some values. Now, this FormView also contains 4 FileUpload controls, and as you might know that these fileupload controls require a full postback since most browsers do not let Javascript access the

How to retain file input value after form submission with errors?

隐身守侯 提交于 2019-12-10 15:21:33
问题 I have what seems to be a rather basic question and wanted to confirm how best to deal with it. I have a form with a number of inputs one of which is a file input. On submission of the form there are a number of validation checks in PHP to confirm all necessary fields have been filled out as they should have been (and if not then it notifies the user to fill out the remainder and shows them the form again without submitting it). This is all fine but if a user has selected a file then i don't

How to Keep colors on gridview after Postback? asp.net c#

怎甘沉沦 提交于 2019-12-10 15:03:50
问题 I have a gridview which I change some of the rows colors after using RowDataBound.... Here's my gridview <asp:GridView ID="grdvEventosVendedor" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DatakeyNames="idCita" EmptyDataText="No Hay Eventos Para Este Vendedor" ForeColor="#333333" GridLines="None" AllowSorting="True" onpageindexchanging="grdvEventosVendedor_PageIndexChanging" onrowcommand="grdvEventosVendedor_RowCommand" onsorting="grdvEventosVendedor_Sorting"

how to use __doPostBack function in asp.net

十年热恋 提交于 2019-12-10 14:56:40
问题 i am trying to use __doPostBack function so i can force my page to do post pack on the page load but i am having some difficulties understanding. when i was looking at the examples online. On button click, i want to do the post back but not sure how to complete the code in the code behind. Here is what i have so far: <script type="text/javascript"> function DoPostBack() { __doPostBack('btnNew', 'MyArgument'); } </script> Here is my button <asp:Button ID="btnNew" runat="server"

TextBox causes Button Postback in ASP.NET

我的梦境 提交于 2019-12-10 14:32:45
问题 ASP.NET 2.0, testing in FF3 and IE7. When I hit the 'enter' button from a text box the corresponding "OnClick" event for the first ImageButton in the page is fired. If I remove that image button, it fires the next ImageButton OnClick event on the page. From the FireBug console, if I use JavaScript to submit the Form, this does not happen. But for whatever reason hitting enter from the textbox triggers the unrelated ImageButton event. I found this question which had a similar problem, however

Persist c# objects across postbacks

隐身守侯 提交于 2019-12-10 14:09:14
问题 I've got an asp.net page that has c# code-behind that does some stuff in the Page_Load() method (like query a database and make a few other calls to populate objects with data). I then display this data on the page. This all works fine. I set up a couple of postbacks so that when a value in a listbox is clicked, a panel control is filled with the rest of the corresponding object's data. I thought postbacks were the right way to do this, but this causes the (entire class?) to be re-called,