{
protected void Page_Load(object sender, EventArgs e)
{
}
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);
}
}
---------
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html>
<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>
No comments:
Post a Comment