Link to home
Start Free TrialLog in
Avatar of johnkainn
johnkainn

asked on

Hidden field - cast

I have a web user control in an aspx page.
I want to access a hidden field that is in the web user control.
To access a value from TextBox I do following in code behind of the aspx page:
TextBox h=(TextBox)MyWUC1.FindControl("TextBox1");
string myText = Convert.ToString(h.Text);

How would I get the value from a hidden inputfield that is in the web user control?
If I try following:

HiddenField h = (HiddenField)ProjectSubjectAgeWUC1.FindControl("hidText");

Then I get following error: Unable to cast object of type 'System.Web.UI.HtmlControls.HtmlInputHidden' to type 'System.Web.UI.WebControls.HiddenField'.
ASKER CERTIFIED SOLUTION
Avatar of sunithnair
sunithnair

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial