views:

752

answers:

1

Hi,

In my .aspx page, I have a dropdownlist and a textbox.

The textbox has to be validated depending on the selection in the dropdownlist.

I have only used the validation control on the .aspx page itself (not codebehind).

How can I dynamically change the type of validation on the textbox? programatically?

A: 

Although it's not the most efficient way (because it requires an extra postback), you can set AutoPostBack='true' on your dropdown list, then when you respond to the SelectedIndexChanged event for your dropdownlist, your can modify (enable / disable, etc.) your validation for the textbox.

Keltex