Hi everyone,
I am unable to find out the Id in Javascript from the server control.
I have used the following code,
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkboxHeader" runat="server" AutoPostBack="false" onclick="javascript:selectallrow(this.Id);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkboxBody" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
function selectallrow(Id)
{
var getobj=document.getElementById(Id).value;
alert(getobj);
}
I have replaced also the following script, but nothing works,
var getobj=document.getElementById("<%=Id.ClientID %>").value;
But 'Object required error occurred'
Please provide me a solution
thanks in advance,
Mohan J
I am unable to find out the Id in Javascript from the server control.
I have used the following code,
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkboxHeader" runat="server" AutoPostBack="false" onclick="javascript:selectallrow(this.Id);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkboxBody" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
function selectallrow(Id)
{
var getobj=document.getElementById(Id).value;
alert(getobj);
}
I have replaced also the following script, but nothing works,
var getobj=document.getElementById("<%=Id.ClientID %>").value;
But 'Object required error occurred'
Please provide me a solution
thanks in advance,
Mohan J