Note that there are some explanatory texts on larger screens.

plurals
  1. POHidden Field losing its Value on postback
    primarykey
    data
    text
    <p>I have a ascx page where I am using a hidden field to store the value of a the drop down box as it is generated using a google address finder. My problem is that when I try to store the value directly in the hidden field:</p> <pre><code>hfDdlVerifyID.Value = ddlVerifySS.SelectedValue; </code></pre> <p>in the event of a button click, the value is stored but on postback is lost again. Whereas, if i try to use Scriptmanager to do it, nothing is stored.</p> <pre><code>getBuild.AppendLine("$get('" + hfDdlVerifyID.ClientID + "').value = $get('" + ddlVerifySS.ClientID + ").value;"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "storeHidden", getBuild.ToString(), true); // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "storeHidden", getBuild.ToString(), true); string test = hfDdlVerifyID.Value.ToString(); </code></pre> <p>The ascx page is :</p> <pre><code>&lt;asp:UpdatePanel ID = ddlUpdate runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:Panel ID="pVerify" runat="server"&gt; &lt;br /&gt; &lt;fieldset&gt; &lt;legend&gt; &lt;asp:Literal ID="lVerify" runat="server" /&gt; &lt;/legend&gt; &lt;asp:CheckBox ID ="cbVerify" runat ="server" Text ="Use the value from the following list, (Uncheck to accept address as it is)." Checked ="true" /&gt; &lt;br /&gt; &lt;asp:DropDownList ID="ddlVerifySS" runat="server" onselectedindexchanged="ddlVerifySS_SelectIndexChange" /&gt; &lt;asp:HiddenField id="hfDdlVerifyID" runat ="server" /&gt; &lt;/fieldset&gt; &lt;/asp:Panel&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;padrap:Button ID ="bVerify" runat ="server" CssClass ="btn" OnClick ="bVerify_Click" Text ="Verify Address" /&gt; &lt;asp:Button ID ="btnSubSite" runat ="server" text ="Save" CssCLass ="btn" OnClick ="save_btn_Click_subSite" onLoad="ddlVerify_Load" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload