How to use Hidden Field?

By James J

Use of HiddenField...

<asp:HiddenField ID="HiddenField1" runat="server" />

public partial class HiddenField : System.Web.UI.Page
{  
    
private string str="Hello";
    
protected void Page_Load(object sender, EventArgs e)
    {
         
HiddenField1.Value=str;
    }
}


-> Then you can access the control HiddenField1 using javascipt:

<script type="text/JavaScript">
Var Hiddenstr=document.getElementByID(“HiddenField1”);
alert(Hiddenstr.value);
</script>

How to use Hidden Field?  (843 Views)