Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to validate data inside a ModalPopupExtender Ajax control?

Status
Not open for further replies.

hanglam

Programmer
Dec 11, 2002
143
US
Hi,

I'm using a ModalPopupExtender with two buttons, an OK button and a Cancel button?

I want to link the OK button to both the onOKScript and onClick event.

In my ModalPopupExtender I have a bunch of DropDownList that I need the user to fill out before closing the ModalPopupExtender.
How do I validate the information from the user without closing the ModalPopupExtender and if the information is valid, how do I do a postback to the server to process the information selected by the user?

My idea was to use both the onOKScript to run some Javascript code and the onClick event to run server-side code.

but which one come first the onOKScript and then the onClick event ? or is it the other way around? and any idea on how to validate the DropDownList information in Javascript? I'm not very familiar with Javascript code.

I'm using ASP.NET 4.0 and the ModalPopupExtender Ajax control.

Thanks,
Hang
 
Use the RequiredFieldValidator for each of the dropdown lists the user must make a selection from.

Code:
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" InitialValue="-1" 
ControlToValidate="ddlSomeDropDownList" runat="server" 
ErrorMessage="Must Make a selection"></asp:RequiredFieldValidator>


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top