How to pass some kind of data to a given Web User Control?

Discussion in 'ASP .Net' started by mehdi_mousavi, Sep 7, 2005.

  1. Hi,
    I need to pass some variables to a given web user ctrl, say,
    myctrl.ascx. e.g., I need to include the user control within a web form
    as follows:

    myctrl.ascx?myparam=myvalue&whatever=another_value

    whilst somewhere else I would call the mentioned ctrl as

    myctrl.ascx?myparam2=myvalue&whatever2=another_value

    What's the way to go?

    Any help would be highly appreciated,

    Cheers,
    Mehdi
     
    mehdi_mousavi, Sep 7, 2005
    #1
    1. Advertising

  2. mehdi_mousavi

    john_teague Guest

    If you create public properties in your web control, you can set those
    in the tag you put on the aspx page.

    ascx code behind:
    public int MyParam{
    get{...}
    set{...}
    }

    aspx page with user control
    <cc1:MyControl MyParam="99"></cc1:MyControl>

    public properties of a control are also available in the aspx code
    behind as well.
     
    john_teague, Sep 7, 2005
    #2
    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. Lord0
    Replies:
    1
    Views:
    587
    Thomas Weidenfeller
    Apr 19, 2006
  2. chiara
    Replies:
    6
    Views:
    494
    Barry Schwarz
    Oct 6, 2005
  3. 2Barter.net
    Replies:
    0
    Views:
    387
    2Barter.net
    Dec 13, 2006
  4. Giampaolo Rodola'

    Searching for some kind of data type

    Giampaolo Rodola', Aug 2, 2008, in forum: Python
    Replies:
    3
    Views:
    318
    Paul Hankin
    Aug 2, 2008
  5. Casey Hawthorne
    Replies:
    385
    Views:
    5,950
    ng2010
    Apr 4, 2010
Loading...

Share This Page