boatdrinks
IS-IT--Management
I have a drop-down box and a textbox. I would like to set the validator of the textbox to require a value only if a specific value is selected in the drop-down. So far this is what I have done, and it does not work. I would like to do this in VB also.
This is in the page_Load
If inserthardware.selectedvalue = "Classroom" then
barcodevalidator.ControlToValidate="insertbarcode"
end if
This is the drop-down in the body of the page
<asp
ropDownList id="inserthardware" width="175" runat="server">
<asp:ListItem value="somethingelse" text="somethingelse"/>
<asp:ListItem value="Classroom" text="Classroom"/>
This is the text box in the body of the page
<asp:Textbox id="Insertbarcode" width="175" runat="server" />
<asp:RequiredFieldValidator id="barcodevalidator" Text="*" ErrorMessage="Barcode" runat="server" />
Please Help
This is in the page_Load
If inserthardware.selectedvalue = "Classroom" then
barcodevalidator.ControlToValidate="insertbarcode"
end if
This is the drop-down in the body of the page
<asp
<asp:ListItem value="somethingelse" text="somethingelse"/>
<asp:ListItem value="Classroom" text="Classroom"/>
This is the text box in the body of the page
<asp:Textbox id="Insertbarcode" width="175" runat="server" />
<asp:RequiredFieldValidator id="barcodevalidator" Text="*" ErrorMessage="Barcode" runat="server" />
Please Help