User control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • david

    #1

    User control

    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:WEBC USTOMCONTROL1 id="WebCustomCo ntrol1"
    consultantid=<% GetConsultantId ();%>

  • david

    #2
    RE: User control

    thanks that works well.

    Cheers

    David

    "Matt Lernout" wrote:
    [color=blue]
    > 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:
    >
    > WEBCUSTOMCONTRO L1 myControl =
    > (WEBCUSTOMCONTR OL1)this.FindCo ntrol("WebCusto mControl1");
    > myControl.consu ltantid = GetConsultantId ();
    >
    > "david" wrote:
    >[color=green]
    > > 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:WEBC USTOMCONTROL1 id="WebCustomCo ntrol1"
    > > consultantid=<% GetConsultantId ();%>
    > >[/color][/color]

    Comment

    Working...