I don't know how to do this in ASP.NET. I've got a page which grabs the stored username of the logged in user. Then it displays that username in a label. I also need to be able to pass that username as a hidden form field back to the same page when the form is submitted.
In the code below, the username is 'major_key' and I want to be able to set the value of a hidden form field to this so I can then append it to the url when the page is submitted...see the action attribute of the form. Basically, I need the code for the hidden field and the action attribute.
Thanks all.
<script language="vb" runat="server">
Public Sub Page_Load(Source As Object, E As EventArgs)
If Not Context.User.Identity.Name = "" Then
major_key.Text = User.Identity.Name
End If
End Sub
</script>
</head>
<body>
<form runat="server" method="post" action="test.aspx?major_key=<%# major_key %>">
<asp:Label id="major_key" runat="server" />
<input type="hidden" id="major_key" value="major_key">
<br><input type="submit">
</form>
</body>
</html>
In the code below, the username is 'major_key' and I want to be able to set the value of a hidden form field to this so I can then append it to the url when the page is submitted...see the action attribute of the form. Basically, I need the code for the hidden field and the action attribute.
Thanks all.
<script language="vb" runat="server">
Public Sub Page_Load(Source As Object, E As EventArgs)
If Not Context.User.Identity.Name = "" Then
major_key.Text = User.Identity.Name
End If
End Sub
</script>
</head>
<body>
<form runat="server" method="post" action="test.aspx?major_key=<%# major_key %>">
<asp:Label id="major_key" runat="server" />
<input type="hidden" id="major_key" value="major_key">
<br><input type="submit">
</form>
</body>
</html>