Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Clashing of two Events

Clashing of two Events

Scheduled Pinned Locked Moved ASP.NET
questiondesignsysadminhelptutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lijukv
    wrote on last edited by
    #1

    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. 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. 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? ------------------------------------------ The code is server side code 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 for txtDevelopmentExperience ------------------------------------------ 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())); ------

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups