how to get the hidden field values in code behind

Joined
Dec 23, 2009
Messages
4
Reaction score
0
protected void dd_SelectedIndexChanged(object sender, EventArgs e)
{
RegisterClientScriptBlock("", "ConfirmIt()");

/*Now Access the Hidden Filed Value Since it Contain the value that
User Clicked OK or Cancel */
int result = int.Parse(HiddenField1.Value.ToString());
if (result == 1)
{

// Do somthing

}
}

My Page has-
<ItemTemplate>
<asp:HiddenField ID="HiddenField1" runat="server" Value="" />
<asp:DropDownList id="dd" runat="server" onselectedindexchanged="dd_SelectedIndexChanged" AutoPostBack="True">
<asp:ListItem Value="Pending">Pending</asp:ListItem>
<asp:ListItem Value="Yes">Yes</asp:ListItem>
<asp:ListItem Value="No">No</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>

My code goes like this..If user changes a dropdown value from pending to yes/no or vice-versa,a dialog box should appear to confirm the changes but -

The error which i am getting is
The name 'HiddenField1' does not exist in the current context
The name 'RegisterClientScriptBlock' does not exist in the current context

How to resolve that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top