Saturday, March 24, 2012

Web Custom Control (Button)

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
StevenHi 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" <steven_@.anonymous.com>
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
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" <scott@.nospam.odetocode.com> wrote in message
news:jlsh61pg8ojennqbjjpo815apsk52a53lk@.4ax.com...
> 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" <steven_@.anonymous.com>
> 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:

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" <steven_@.anonymous.com>
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" <scott@.nospam.odetocode.com> wrote in message
>news:jlsh61pg8ojennqbjjpo815apsk52a53lk@.4ax.com...
>> 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" <steven_@.anonymous.com>
>> 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:

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" <steven_@.anonymous.com>
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" <scott@.nospam.odetocode.com> wrote in message
>news:jlsh61pg8ojennqbjjpo815apsk52a53lk@.4ax.com...
>> 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" <steven_@.anonymous.com>
>> 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
>>>
>

0 comments:

Post a Comment