pass value of a variable to user control

Discussion in 'ASP .Net' started by Hermit Dave, Dec 12, 2003.

  1. Hermit Dave

    Hermit Dave Guest

    Hi,

    Trying to pass a value to user control within a page.
    1. Couldnt find a way to pass it from code behind file.
    2. Trying to pass it from aspx page... using EditURL='<%
    "mypage.aspx?myvar=" + myvalue %>' assigns value of EditURL=''
    I have tried using a local variable... directly trying to read it off
    Request object and even tried using session variable...

    could be glad if someone could tell me how to get it right... thanks,

    regards,

    Hermit Dave
     
    Hermit Dave, Dec 12, 2003
    #1
    1. Advertising

  2. You need to use properties and pass them in the page load events for
    example.....

    Doug Stevens, another MVP has this very useful example whih explains the
    approach

    http://www.dotnetjunkies.com/Article/E1F97CE9-7834-46FA-BED9-866F720AB013.dc
    ik


    --
    Regards

    John Timney (Microsoft ASP.NET MVP)
    ----------------------------------------------
    <shameless_author_plug>
    Professional .NET for Java Developers with C#
    ISBN:1-861007-91-4
    Professional Windows Forms
    ISBN: 1861005547
    Professional JSP 2nd Edition
    ISBN: 1861004958
    Professional JSP
    ISBN: 1861003625
    Beginning JSP Web Development
    ISBN: 1861002092
    </shameless_author_plug>
    ----------------------------------------------

    "Hermit Dave" <> wrote in message
    news:...
    > Hi,
    >
    > Trying to pass a value to user control within a page.
    > 1. Couldnt find a way to pass it from code behind file.
    > 2. Trying to pass it from aspx page... using EditURL='<%
    > "mypage.aspx?myvar=" + myvalue %>' assigns value of EditURL=''
    > I have tried using a local variable... directly trying to read it off
    > Request object and even tried using session variable...
    >
    > could be glad if someone could tell me how to get it right... thanks,
    >
    > regards,
    >
    > Hermit Dave
    >
    >
     
    John Timney \(Microsoft MVP\), Dec 12, 2003
    #2
    1. Advertising

  3. Hermit Dave

    Hermit Dave Guest

    Hello John,

    Thanks for the pointer. That article hopefully did show me what i wasnt
    doing...
    For same reason i did look around for the instance of user control in the
    data member declaration earlier and couldnt find it...
    Anyho... have to map the instance on aspx page to the code behind.. then i
    should be able to populate the properties.. (ealier was passing hard coded
    values from within aspx and that worked)
    Thanks mate,

    Regards,

    Hermit Dave

    "John Timney (Microsoft MVP)" <> wrote in message
    news:...
    > You need to use properties and pass them in the page load events for
    > example.....
    >
    > Doug Stevens, another MVP has this very useful example whih explains the
    > approach
    >
    >

    http://www.dotnetjunkies.com/Article/E1F97CE9-7834-46FA-BED9-866F720AB013.dc
    > ik
    >
    >
    > --
    > Regards
    >
    > John Timney (Microsoft ASP.NET MVP)
    > ----------------------------------------------
    > <shameless_author_plug>
    > Professional .NET for Java Developers with C#
    > ISBN:1-861007-91-4
    > Professional Windows Forms
    > ISBN: 1861005547
    > Professional JSP 2nd Edition
    > ISBN: 1861004958
    > Professional JSP
    > ISBN: 1861003625
    > Beginning JSP Web Development
    > ISBN: 1861002092
    > </shameless_author_plug>
    > ----------------------------------------------
    >
    > "Hermit Dave" <> wrote in message
    > news:...
    > > Hi,
    > >
    > > Trying to pass a value to user control within a page.
    > > 1. Couldnt find a way to pass it from code behind file.
    > > 2. Trying to pass it from aspx page... using EditURL='<%
    > > "mypage.aspx?myvar=" + myvalue %>' assigns value of EditURL=''
    > > I have tried using a local variable... directly trying to read it off
    > > Request object and even tried using session variable...
    > >
    > > could be glad if someone could tell me how to get it right... thanks,
    > >
    > > regards,
    > >
    > > Hermit Dave
    > >
    > >

    >
    >
     
    Hermit Dave, Dec 13, 2003
    #3
  4. Hermit Dave

    Rocky Moore Guest

    "Hermit Dave" <> wrote in message
    news:...
    > Hi,
    >
    > Trying to pass a value to user control within a page.
    > 1. Couldnt find a way to pass it from code behind file.
    > 2. Trying to pass it from aspx page... using EditURL='<%
    > "mypage.aspx?myvar=" + myvalue %>' assigns value of EditURL=''
    > I have tried using a local variable... directly trying to read it off
    > Request object and even tried using session variable...
    >
    > could be glad if someone could tell me how to get it right... thanks,
    >
    > regards,
    >
    > Hermit Dave


    I know you have already been pointed to the Properites as fits your
    question.

    Just as a side note though, you can also use a Cache object for passing
    information to an from controls and web user controls. They are very handy.

    --
    Rocky Moore
    www.HintsAndTips.com
     
    Rocky Moore, Dec 13, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    4,457
  2. Phil Certain
    Replies:
    12
    Views:
    853
    Phil Certain
    Feb 1, 2005
  3. Tricky
    Replies:
    0
    Views:
    592
    Tricky
    Mar 19, 2009
  4. Tricky
    Replies:
    0
    Views:
    1,028
    Tricky
    Mar 19, 2009
  5. Reuven
    Replies:
    0
    Views:
    604
    Reuven
    Mar 19, 2009
Loading...

Share This Page