Control's Name set at design time, retrived at runtme

C

CsaaGuy

Hi, i created a class that i have showing up at design time and i have
to save some of the properties to the viewstate at runtime. It all
works fine, however the issue is if i have more that one version of the
this control on the form (which is possible) I don't know how to get
ahold of the name property that was set at design time. I need this to
tell the viewstate which version of the control's property is being
save/retrieved. Thanks.
 
B

Brock Allen

I can't quite tell what situation you're talking about, but if you have a
reference to a server-side control at runtime, you can use the ClientID property
to determine what the ID will be rendered as in the client.
 
C

CsaaGuy

I check all the ID type properties and they are all nothing. In the
property window is the name of the control but at run time there is no
name property. The ID and ClientID properties are set to nothing. This
is a class i wrote myself and is not inheiring anything. Its working as
designed except for the in ability to retrive the name at runtime.
Thanks for you response.
 
B

Brock Allen

Maybe it's time to post a small snippet of your class' code to illustrate
the problem.

I just reread your post, and maybe your question could be rephrased as this:

I have a custom control saving data in ViewState using an ID such as "Text".
If I have 2 of these on the page, will those "Text" IDs in ViewState conflict?

If this is your question, then the answer is "no" they won't conflict. Each
control on the page has its own private ViewState collection to use and index
into however it wants to.
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top