I have a radiobtton and textbox associated with it.
<asp:RadioButtonList ID="DBACd" runat="server" RepeatDirection="Horizontal" >
<asp:ListItem Text="Doing Business As: or" Value="D" />
<asp:ListItem Text="Optional Name" Value="O" Selected="true" />
</asp:RadioButtonList>
<asp:TextBox runat="server" MaxLength="20" Width="90%" ID="DBAName" CssClass="fdata"></asp:TextBox>
when i click on 1st item, the text box should be populated with first 3 letters as "DBA" and then the customer should be able to enter the rest of the field. When we navigate off the page, this value will be saved to the database and when we come back to the page the value saved in the database will be displayed in the textbox with 1st being selected.
When i click on the 2nd item, the textbox should be balnked out totally.
Can anyone please help me. I've written the javascript in onclick which is not doing the correct thing. Can anyone please help me where i am doing wrong. I need this immediately.
function ShowHideDBA()
{
if (document.getElementById("<%=DBACd.ClientId %>"))
{
if (document.getElementById("<%=DBACd.ClientId %>" + "_0").checked)
{
// start 1.02
//document.getElementById("<%=DBAName.ClientId %>").value ="DBA";
if (document.getElementById("<%=DBAName.ClientId %>").value != "")
{
document.getElementById("<%=DBAName.ClientId %>").value = document.getElementById("<%=DBAName.ClientId %>").value;
}
else
{
document.getElementById("<%=DBAName.ClientId %>").value ="DBA";
}
// end 1.02
}
else
{
if ((document.getElementById("<%=DBAName.ClientId %>").value != "") && (document.getElementById("<%=DBAName.ClientId %>").value != "DBA"))
{
document.getElementById("<%=DBAName.ClientId %>").value = document.getElementById("<%=DBAName.ClientId %>").value;
}
else
{
document.getElementById("<%=DBAName.ClientId %>").value ="";
}
}
}
else
{
document.getElementById("<%=DBAName.ClientId %>").value ="";
}
}
<asp:RadioButtonList ID="DBACd" runat="server" RepeatDirection="Horizontal" >
<asp:ListItem Text="Doing Business As: or" Value="D" />
<asp:ListItem Text="Optional Name" Value="O" Selected="true" />
</asp:RadioButtonList>
<asp:TextBox runat="server" MaxLength="20" Width="90%" ID="DBAName" CssClass="fdata"></asp:TextBox>
when i click on 1st item, the text box should be populated with first 3 letters as "DBA" and then the customer should be able to enter the rest of the field. When we navigate off the page, this value will be saved to the database and when we come back to the page the value saved in the database will be displayed in the textbox with 1st being selected.
When i click on the 2nd item, the textbox should be balnked out totally.
Can anyone please help me. I've written the javascript in onclick which is not doing the correct thing. Can anyone please help me where i am doing wrong. I need this immediately.
function ShowHideDBA()
{
if (document.getElementById("<%=DBACd.ClientId %>"))
{
if (document.getElementById("<%=DBACd.ClientId %>" + "_0").checked)
{
// start 1.02
//document.getElementById("<%=DBAName.ClientId %>").value ="DBA";
if (document.getElementById("<%=DBAName.ClientId %>").value != "")
{
document.getElementById("<%=DBAName.ClientId %>").value = document.getElementById("<%=DBAName.ClientId %>").value;
}
else
{
document.getElementById("<%=DBAName.ClientId %>").value ="DBA";
}
// end 1.02
}
else
{
if ((document.getElementById("<%=DBAName.ClientId %>").value != "") && (document.getElementById("<%=DBAName.ClientId %>").value != "DBA"))
{
document.getElementById("<%=DBAName.ClientId %>").value = document.getElementById("<%=DBAName.ClientId %>").value;
}
else
{
document.getElementById("<%=DBAName.ClientId %>").value ="";
}
}
}
else
{
document.getElementById("<%=DBAName.ClientId %>").value ="";
}
}