Asp.net validation
-
Hi Friends, My Scenario is I've got two controls TextBox and DropDownlist. I want to validate these as If Textbox is empty then you must select a valued from dropdown list , if text box is not empty then its up to user weather he/she wants to select a value from dropdownlist or not. Can I validate using Validation controls? If yes then how ? Any example or source code will be appreciated.
Naveed Kamboh Complexity kills, Write easy code for your self. Cash-time
-
Hi Friends, My Scenario is I've got two controls TextBox and DropDownlist. I want to validate these as If Textbox is empty then you must select a valued from dropdown list , if text box is not empty then its up to user weather he/she wants to select a value from dropdownlist or not. Can I validate using Validation controls? If yes then how ? Any example or source code will be appreciated.
Naveed Kamboh Complexity kills, Write easy code for your self. Cash-time
-
Just a quick question. Where is the place you need to check this. I mean on a button click or something ?
Thanks Laddie Kindly rate if the answer was helpful
Yes on an image button click. I am after client side validation!
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
-
Yes on an image button click. I am after client side validation!
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
-
Yes on an image button click. I am after client side validation!
Naveed Kamboh Complexity kills, Write easy code for your self. Punjabi stuff
Ok then create a javascript to validate your control. if say function validate() { //Check if the text box value is blank if(document.getElementById("txtBox1").Value.length == 0) { //If yes check if the value of listbox is null if(documen.getElementById("listbox").Value == null) { alert("You have to select a value"); return false; } } } Now in the OnClientClick property of the image button give this funcion name You probably will not be able to achieve this using validation controls becuase they can be used against only one control.
Thanks Laddie Kindly rate if the answer was helpful