javascript - Getting null value of the hidden field at server-side -
i calling java-script function, in passing value of hidden field, hidden field want use @ server-side, value of hidden field null.
client side function
function getdetails() { document.forms[0].hdnnode.value=tree_selected_id; //html hidden field. str="cmp_12"; str_array=str.split("_"); var str_array1=str_array[0]; var str_array2=str_array[1]; document.getelementbyid("<%=hiddennodeid.clientid %>").value=str_array1; document.getelementbyid("<%=hiddentreeid.clientid %>").value=str_array2; }
server side function
public sub insertnodes(byval nodeid string) dim objerrorobj new errorobj dim parentid string parentid = hiddennodeparent.value nodeid = hiddennodeid.value dim nodeidtree string nodeidtree = hiddentreeid.value end sub
i using hidden fields updatepanels ( hidden field must send server use in partial postback ) , can try set enableviewstate = true ( whole page post ).
aspx:
<asp:updatepanel id="updatepanel1" runat="server" onload="updatepanel1_load" updatemode="conditional" childrenastriggers="true"> <contenttemplate> <asp:hiddenfield runat="server" id="linesback" value="0"/> <asp:updateprogress id="updateprogress1" runat="server" displayafter="10" associatedupdatepanelid="updatepanel1"> <progresstemplate> <img id="spinner" alt="spinner" src="../pictures/spinner_30x30.gif" /> </progresstemplate> </asp:updateprogress> <div id="back" class="newresultpanel" runat="server" ></div> </contenttemplate> </asp:updatepanel>
html:
var = document.getelementbyid('<%= linesback.clientid %>').value;
cs:
linesback.value = countrows.tostring();
Comments
Post a Comment