Hi I have created a datalist which is bound to a table, but it has 2 additional columns, one is a checkbox the other a textbox. When a user ticks a checkbox i want them to be able to type into the text box however the textbox should be disabled until they tick the checkbox. I have the following code:-
<aspataList ID="Dl_MildModerate" runat="server" RepeatColumns="2"
BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
CellPadding="4" ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#F7F7DE" />
<SelectedItemStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<asp:CheckBox ID="DL_Check" runat ="server" Width="5%" onclick="enableTextBox('<%=Txt_Dos.ChildID %>')" />
<asp:TextBox ID ="Txt_Dos" runat ="server" Width = "20%" Enabled="false" >
</asp:TextBox>
<%#Eval("Type"%>
</ItemTemplate>
</aspataList>
And I am using the following Java code
function enableTextBox(txtid)
{
var txt = document.getElementByID(txtid);
txt.enabled = true
}
however the function returns the object doesn't support this method error.
Any advice please would be welcome
<aspataList ID="Dl_MildModerate" runat="server" RepeatColumns="2"
BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
CellPadding="4" ForeColor="Black" GridLines="Vertical">
<FooterStyle BackColor="#CCCC99" />
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#F7F7DE" />
<SelectedItemStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<ItemTemplate>
<asp:CheckBox ID="DL_Check" runat ="server" Width="5%" onclick="enableTextBox('<%=Txt_Dos.ChildID %>')" />
<asp:TextBox ID ="Txt_Dos" runat ="server" Width = "20%" Enabled="false" >
</asp:TextBox>
<%#Eval("Type"%>
</ItemTemplate>
</aspataList>
And I am using the following Java code
function enableTextBox(txtid)
{
var txt = document.getElementByID(txtid);
txt.enabled = true
}
however the function returns the object doesn't support this method error.
Any advice please would be welcome