469,951 Members | 2,428 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,951 developers. It's quick & easy.

Access hidden controls on ascx page

I have a hidden control
<input id="FieldSortOrder" type="hidden" name="FieldSortOrder"
runat="server"> in a ascx page. I want to store some value in this
control in the code behind page.

FieldSortOrder.Value = "xyz"

I am getting compilation errors - 'FieldSortOrder' is not declared.

The same thing is working good on aspx. how can it be done on ascx?
Thanks.

Apr 26 '06 #1
2 2475

Try putting a public property on the ASCX... and getting to it that way.
public string MyFSO
{
get { return this.FieldSortOrder.value; }
}
Then refer to it by the controlname//property name.

...
<kr*********@gmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
I have a hidden control
<input id="FieldSortOrder" type="hidden" name="FieldSortOrder"
runat="server"> in a ascx page. I want to store some value in this
control in the code behind page.

FieldSortOrder.Value = "xyz"

I am getting compilation errors - 'FieldSortOrder' is not declared.

The same thing is working good on aspx. how can it be done on ascx?
Thanks.

Apr 26 '06 #2
Are you trying to access the control from within the ASCX code behind, or
from within the Page's code behind?
If you're trying to access it from the Page's code behind, this should help:
http://SteveOrr.net/faq/PassDataToUserControl.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
<kr*********@gmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
I have a hidden control
<input id="FieldSortOrder" type="hidden" name="FieldSortOrder"
runat="server"> in a ascx page. I want to store some value in this
control in the code behind page.

FieldSortOrder.Value = "xyz"

I am getting compilation errors - 'FieldSortOrder' is not declared.

The same thing is working good on aspx. how can it be done on ascx?
Thanks.

Apr 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by paul meaney | last post: by
5 posts views Thread by djscratchnsniffing | last post: by
5 posts views Thread by c676228 | last post: by
5 posts views Thread by tshad | last post: by
8 posts views Thread by mark.norgate | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.