Clashing of two Events
-
:) For example I am having two controls, textbox and dropdownlist For both the controls autopostback is true. I have written some code in the textbox's textchanged event The problem is -------------- after I do some change in text in the textbox control and directly select an item in the dropdownlist, the page gets vanishes. If i do the same procedure by clicking somewhere else in the form before selecting an item in the dropdownlist then no problem happens What i feel is that the textchanged event and selectedIndexchanged event is getting fired together.(I am not sure my assumption is right) What is the problem and how can i solve it? :rose:
-
:) For example I am having two controls, textbox and dropdownlist For both the controls autopostback is true. I have written some code in the textbox's textchanged event The problem is -------------- after I do some change in text in the textbox control and directly select an item in the dropdownlist, the page gets vanishes. If i do the same procedure by clicking somewhere else in the form before selecting an item in the dropdownlist then no problem happens What i feel is that the textchanged event and selectedIndexchanged event is getting fired together.(I am not sure my assumption is right) What is the problem and how can i solve it? :rose:
lijukv wrote: I have written some code in the textbox's textchanged event Is this server side code? lijukv wrote: the page gets vanishes. What does this mean, that the page posts back? lijukv wrote: If i do the same procedure by clicking somewhere else in the form before selecting an item in the dropdownlist then no problem happens What exactly is the problem? Don't you want it to postback?
-
lijukv wrote: I have written some code in the textbox's textchanged event Is this server side code? lijukv wrote: the page gets vanishes. What does this mean, that the page posts back? lijukv wrote: If i do the same procedure by clicking somewhere else in the form before selecting an item in the dropdownlist then no problem happens What exactly is the problem? Don't you want it to postback?
-
The code is server side code Actually the whole control in the page gets vanishes!.No other actions can be done in that active browser. We have to finally close the browser and run the page again.
lijukv wrote: Actually the whole control in the page gets vanishes!.No other actions can be done in that active browser. Oh, so it's a User Control on the page? Do you create it dynamically? Regards, Alvaro
-
lijukv wrote: Actually the whole control in the page gets vanishes!.No other actions can be done in that active browser. Oh, so it's a User Control on the page? Do you create it dynamically? Regards, Alvaro
all the controls are server controls System.Web.UI.WebControls.Dropdownlist System.Web.UI.WebControls.TextBox I am not creating it dynamically I don't think its the problem of the code in textChanged event bcoz if after changing the text in the textbox if we click anywhere else on the page then click on the dropdownlist, no problem arise Anyway the code for the textchanged event ------------------------------------------ lblMessage.Text = ""; if(txtDevelopmentExperience.Text != "") { RangeValidator objRangeValidator = new RangeValidator(); this.FindControl("Form1").Controls.Add(objRangeValidator); objRangeValidator.ControlToValidate = "txtDevelopmentExperience"; objRangeValidator.Type = ValidationDataType.Double; objRangeValidator.MaximumValue = "10"; objRangeValidator.MinimumValue = "0"; objRangeValidator.Validate(); if(objRangeValidator.IsValid != true) { lblMessage.ForeColor = Color.Red; lblMessage.Text = "Invalid data in DE"; return; } objRangeValidator.ControlToValidate = "txtTestingExperience"; objRangeValidator.Type = ValidationDataType.Double; objRangeValidator.MaximumValue = "10"; objRangeValidator.MinimumValue = "0"; objRangeValidator.Validate(); if(objRangeValidator.IsValid != true) { lblMessage.ForeColor = Color.Red; lblMessage.Text = "Invalid data in TE"; return; } if(txtTestingExperience.Text == "")txtTestingExperience.Text = "0"; txtTotalExperience.Text = Convert.ToString(Convert.ToDouble(txtDevelopmentExperience.Text.Trim()) + Convert.ToDouble(txtTestingExperience.Text.Trim())); --------------------------------------------- Even if i am not using the dynamic creation of range validator the problem will come In the second last line of the code I am changing the text of another textbox(txtTestingExperience) thereby the textchanged event of this textbox(txtTestingExperience) will get fired up(same type of code is written in this But i request u to try with basic code to try out .Changing the tex and directly changing the selected index of dropdownlist. Thanks for reading and continously helping me :) :rose: