Tuesday, 10 March 2015

Hidden field data

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script language="javascript">
        function ShowHdnVal() {
            alert(document.getElementById('hdnAdi').value);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <input type="hidden" id="hdnAdi" />
        <asp:Button runat="server" ID="btnPost" Text="Post Me" OnClick="btnPost_Click" />

        <input type="button" value="Show my hidden value" onclick="ShowHdnVal();" />
    </div>
    </form>
</body>
</html>

---------------------------------------

protected void btnPost_Click(object sender, EventArgs e)
    {
        if (true)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString(), "document.getElementById('hdnAdi').value='Avaneesh Dash';", true);
        }
    }

No comments:

Post a Comment