i have a textbox which is associated to radiobutton list. if i checked first radio button then textbox should validate and if i checked second radio button then textbox should validate.
<asp:Radiobuttonlist id="search" runat="server" repeatcolumns="4" reapeatdirection="horizontal" onselectedindexchanged="search_selectedindexchanged">
<asp:listitem selected="true">c1</asp;listitem>
<asp:listitem >c2</asp;listitem>
<asp:listitem >c3</asp;listitem>
<asp:listitem >c4</asp;listitem>
</asp:Radiobuttonlist>
<input type="text" name="search" runat="server" id="txtsearch" Placeholder="c1"/>
<asp:button id="btnsearch" runat="server"/>
cs code:
protected void search_selectedindexchanged(object sender, EventArgs e)
{
txtsearch.value="";
if(search.selecteditem.text=="c1"
{
txtsearch.attributes.add("placeholder","enter c1");
}
if(search.selecteditem.text=="c2"
{
txtsearch.attributes.add("placeholder","enter c2");
}
if(search.selecteditem.text=="c3"
{
txtsearch.attributes.add("placeholder","enter c3");
}
if(search.selecteditem.text=="c4"
{
txtsearch.attributes.add("placeholder","enter c4");
}
}