User control

G

Guest

I am trying to create a user control that I can pass in a string value, that
is read from the cookie and defined as a public string in the code behind.
The GetConsultantId(); method never gets called. How can I pass in a dynamic
value to a user control ? Is this even possible.

<CUSTOMTOP:WEBCUSTOMCONTROL1 id="WebCustomControl1"
consultantid=<%GetConsultantId();%>
 
G

Guest

thanks that works well.

Cheers

David

Matt Lernout said:
Is there a requirement to pass the value at the tag level? I'm not sure if
that is possible or not...

If the cookie is read and stored in the codebehind for the control, what is
stopping you from likewise setting the property for that control there?

If GetConsultantId() resides in the usercontrol's codebehind, it's as simple
as setting the property in the control's Page_Load event.

If GetConsultantId() resides in your Page's codebehind, you can set the
property in that Page's Page_Load event like so:

WEBCUSTOMCONTROL1 myControl =
(WEBCUSTOMCONTROL1)this.FindControl("WebCustomControl1");
myControl.consultantid = GetConsultantId();
 

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

Top