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. Advertisements

  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. Advertisements

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. Reny J Joseph Thuthikattu
    Replies:
    1
    Views:
    818
    =?Utf-8?B?UHJha2FzaC5ORVQ=?=
    Dec 30, 2004
  2. ABC
    Replies:
    1
    Views:
    2,833
    Larry
    Oct 4, 2005
  3. ABC
    Replies:
    0
    Views:
    613
  4. Lord0
    Replies:
    1
    Views:
    764
    Thomas Weidenfeller
    Apr 19, 2006
  5. chiara
    Replies:
    6
    Views:
    732
    Barry Schwarz
    Oct 6, 2005
  6. 2Barter.net
    Replies:
    0
    Views:
    591
    2Barter.net
    Dec 13, 2006
  7. Giampaolo Rodola'

    Searching for some kind of data type

    Giampaolo Rodola', Aug 2, 2008, in forum: Python
    Replies:
    3
    Views:
    488
    Paul Hankin
    Aug 2, 2008
  8. ABC
    Replies:
    0
    Views:
    341
Loading...