AutoPostBack erases Validator's error message

  • Thread starter ChInKPoInt CumPeeWaRe [No MCSD]
  • Start date
C

ChInKPoInt CumPeeWaRe [No MCSD]

I have a (1) Textbox and (2) Dropdownlist

(1) is using RequiredFieldValidator
(2) is using AutoPostBack

Now, the problem is: when (2) is fired up and it reloads the page which
erases the error message displayed in (1). Any solutions or tips to solve
this problem?

C.P. [No MCSD]
 
C

ChInKPoInt CuMPeEWaRe [No MCSD]

I think I got it working.. I am answering the question myself.. LOL...

public void Page_Load(object sender, System.EventArgs e)
if (IsPostBack)
Page.Validate();
}

then wrap the onchange code with this thing:

private void myDropdown_SelectedIndexChanged(object sender, System.EventArgs
e) {
if (Page.IsValid)
{
// code here..
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top