asp.net - Adding runat server to HTML control giving error -
i want access ahtml control on server side, while adding runat= server, giving me error as
'chka1<%# (container.recordindex) %>' not valid identifier.
here html
<input type="checkbox" runat="server" id="chka1<%# (container.recordindex)%>" name="chkac1" style="width: 17px; height: 17px;" value="<%# (container.recordindex)%>" onclick="appovechecka(this)" /> when remove runat=server works properly.
why not working runat=server. suggestion
update
the id's changing accordingly of checkboxes. here code have written
var checkboxid; var status; var arra = []; var arrb = []; var rowindex function appovechecka(chk) { status = true; checkboxid = $(chk).attr("id"); funclientselectafter(status, checkboxid); } function appovecheckb(chk) { status = true; checkboxid = $(chk).attr("id"); funclientselectafter1(status, checkboxid); } function funclientselectafter(status, checkboxid) { if (status && checkboxid != null) { var len = checkboxid.length; if (len >= 7) { rowindex = checkboxid.substring(checkboxid.length - 2, checkboxid.length); } else { rowindex = checkboxid.substring(checkboxid.length - 1, checkboxid.length); } (var col = 1; col <= 4; col++) { if (("chka" + col + rowindex) == checkboxid) { if (document.getelementbyid("chka" + col + rowindex).checked == true) { $("#chka" + col + rowindex).attr("checked", true); arra[rowindex] = col; continue; } else arra[rowindex] = 0 } $("#chka" + col + rowindex).attr("checked", false); } document.getelementbyid("hidratea").value = arra.join(); // alert(document.getelementbyid("hidratea").value); } }
the id going typed identifier in c#. therefore id can't change , can't contain invalid characters.
the simple solution remove id attribute.
<input type="checkbox" runat="server" id="chka1" name="chkac1" style="width: 17px; height: 17px;" value="<%# (container.recordindex)%>" onclick="appovechecka(this)" />
Comments
Post a Comment