html - JavaScript Pass button id to an asp.net hiddenfield -
i got silly question question stated,the failed code shown below:
<script type="text/javascript"> function hisenlarge(id) { var parent = id; document.getelementbyid('hiddenfield1').value = parent; } </script>
html:
<button type="button" id="kkkk" onclick="hisenlarge(this.id)"></button> <asp:hiddenfield id="hiddenfield1" runat="server" value=""/>
vbcode
protected sub commentbutton_click(sender object, e eventargs) handles commentbutton.click dim c_id string c_id = hiddenfield1.value.tostring
document.getelementbyid('hiddenfield1').value = parent;
this not html hiddenfield1
.so should reference clientid
document.getelementbyid('<%=hiddenfield1.clientid %>').value= parent;
Comments
Post a Comment