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.FindCont rol("TextB ox1");
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)ProjectSubjec tAgeWUC1.F indControl ("hidText" );
Then I get following error: Unable to cast object of type 'System.Web.UI.HtmlControl s.HtmlInpu tHidden' to type 'System.Web.UI.WebControls .HiddenFie ld'.
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.FindCont
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)ProjectSubjec
Then I get following error: Unable to cast object of type 'System.Web.UI.HtmlControl
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.