Web Custom Control (Button)

Discussion in 'ASP .Net' started by Steven, Apr 22, 2005.

  1. Steven

    Steven Guest

    Hello,

    I'm creating a list of buttons in web custom control. When I'm creating them
    I'm giving the name of each button as this.UniqueId. But this is aslways
    giving me the "WebCustomControl1" as the UniqueId. So for each button the
    UniqueId is "WebCustomControl". Is there anyway I can declare the UniqueID
    to be the 'Integer x', which will increment in a loop starting from 1. So
    Button1 will get UniqueID as 1,...

    How can I do this?
    Please help

    Thanks
    Steven
     
    Steven, Apr 22, 2005
    #1
    1. Advertising

  2. Steven

    Scott Allen Guest

    Hi Steven:

    You can always set the ID property of the control to whatever you
    need. Are you having trouble setting up the variable and the loop?

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Thu, 21 Apr 2005 18:40:50 -0700, "Steven" <>
    wrote:

    >Hello,
    >
    >I'm creating a list of buttons in web custom control. When I'm creating them
    >I'm giving the name of each button as this.UniqueId. But this is aslways
    >giving me the "WebCustomControl1" as the UniqueId. So for each button the
    >UniqueId is "WebCustomControl". Is there anyway I can declare the UniqueID
    >to be the 'Integer x', which will increment in a loop starting from 1. So
    >Button1 will get UniqueID as 1,...
    >
    >How can I do this?
    >Please help
    >
    >Thanks
    >Steven
    >
     
    Scott Allen, Apr 22, 2005
    #2
    1. Advertising

  3. Steven

    Steven Guest

    Hi Scott,

    Thanks for your reply. I want to set the ID property for each Button in the
    control. Since name is the unique property for button, I want to set it
    different for each button.
    If I set it to any value instead of 'this.UniqueId', I'm unable to get the
    response back from button. (eg., I'm unable to hit the Button_click event in
    the program).
    If I set it to this.UniqueID, eveything works fine. But this.UniqueID is
    giving the same name 'WebControl1' for each button.

    How should I resolve this problem.

    Regards
    Steven


    "Scott Allen" <> wrote in message
    news:...
    > Hi Steven:
    >
    > You can always set the ID property of the control to whatever you
    > need. Are you having trouble setting up the variable and the loop?
    >
    > --
    > Scott
    > http://www.OdeToCode.com/blogs/scott/
    >
    > On Thu, 21 Apr 2005 18:40:50 -0700, "Steven" <>
    > wrote:
    >
    >>Hello,
    >>
    >>I'm creating a list of buttons in web custom control. When I'm creating
    >>them
    >>I'm giving the name of each button as this.UniqueId. But this is aslways
    >>giving me the "WebCustomControl1" as the UniqueId. So for each button the
    >>UniqueId is "WebCustomControl". Is there anyway I can declare the UniqueID
    >>to be the 'Integer x', which will increment in a loop starting from 1. So
    >>Button1 will get UniqueID as 1,...
    >>
    >>How can I do this?
    >>Please help
    >>
    >>Thanks
    >>Steven
    >>

    >
     
    Steven, Apr 22, 2005
    #3
  4. Steven

    Scott Allen Guest

    Steven:

    Could you post some code? The version that does not use UniqueID?
    this.UniqueID would be the ID of the ascx web control - the parent
    control. You wouldn't want to use this to name the child controls.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Fri, 22 Apr 2005 08:41:48 -0700, "Steven" <>
    wrote:

    >Hi Scott,
    >
    >Thanks for your reply. I want to set the ID property for each Button in the
    >control. Since name is the unique property for button, I want to set it
    >different for each button.
    >If I set it to any value instead of 'this.UniqueId', I'm unable to get the
    >response back from button. (eg., I'm unable to hit the Button_click event in
    >the program).
    >If I set it to this.UniqueID, eveything works fine. But this.UniqueID is
    >giving the same name 'WebControl1' for each button.
    >
    >How should I resolve this problem.
    >
    >Regards
    >Steven
    >
    >
    >"Scott Allen" <> wrote in message
    >news:...
    >> Hi Steven:
    >>
    >> You can always set the ID property of the control to whatever you
    >> need. Are you having trouble setting up the variable and the loop?
    >>
    >> --
    >> Scott
    >> http://www.OdeToCode.com/blogs/scott/
    >>
    >> On Thu, 21 Apr 2005 18:40:50 -0700, "Steven" <>
    >> wrote:
    >>
    >>>Hello,
    >>>
    >>>I'm creating a list of buttons in web custom control. When I'm creating
    >>>them
    >>>I'm giving the name of each button as this.UniqueId. But this is aslways
    >>>giving me the "WebCustomControl1" as the UniqueId. So for each button the
    >>>UniqueId is "WebCustomControl". Is there anyway I can declare the UniqueID
    >>>to be the 'Integer x', which will increment in a loop starting from 1. So
    >>>Button1 will get UniqueID as 1,...
    >>>
    >>>How can I do this?
    >>>Please help
    >>>
    >>>Thanks
    >>>Steven
    >>>

    >>

    >
     
    Scott Allen, Apr 23, 2005
    #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. Jonah Olsson
    Replies:
    1
    Views:
    585
    Scott Allen
    Apr 5, 2005
  2. J R M
    Replies:
    2
    Views:
    437
    Charlie@CBFC
    Jun 1, 2006
  3. Matt Sokol
    Replies:
    2
    Views:
    397
    Theo Tillotson
    Aug 7, 2003
  4. Jim Gilligan
    Replies:
    0
    Views:
    161
    Jim Gilligan
    Sep 1, 2005
  5. Leyla

    Web user control - custom web control - java script.

    Leyla, May 1, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    129
    Leyla
    May 1, 2006
Loading...

Share This Page