Home All Groups Group Topic Archive Search About

Client Side Checkbox Code

Author
16 Dec 2005 8:17 PM
rlrcstr
I have a checkbox on a web page.  When it is checked, I want a Table to appear (or disappear when the checkbox is cleared)...  I was hoping to use client side code for this, so I created a short vbscript routine and added this to my code behind module:

chkRecur.Attributes.Add("onchange", "vbscript: ShowRecurringTable")

Now, this works just fine on a couple of textboxes that I'm using, but when I try this technique with the asp checkbox, the "onchange" attribute gets added to a <span> element before the <input> element when rendered... 

Can someone explain why this is happening?  Can someone explain a simple way to accomplish this with an ASP checkbox server control, without requiring a trip back to the server?  Thanks.

Jerry

Author
16 Dec 2005 9:18 PM
Remy
<Span> should not be an issue. Is it not working that way? I often add
my OnChange events into span blocks.

Remy
Author
16 Dec 2005 9:32 PM
rlrcstr
The code never runs when the checkbox is clicked...  I ended up using the
server side event.

Show quote
"Remy" <rblaett***@hotmail.com> wrote in message
news:1134767937.005275.281860@o13g2000cwo.googlegroups.com...
> <Span> should not be an issue. Is it not working that way? I often add
> my OnChange events into span blocks.
>
> Remy
>
Author
19 Dec 2005 3:21 AM
Steven Cheng[MSFT]
Hi Jerry,

The ASP.NET CheckBox control is a customized one compared to the raw html 
<input type=checkbox....> element. So it use a <span> to wrapper the <input
type=checkbox> and a <label> (normal html checkbox dosn't have text
.......).  Thus, all the serverside attributes we apply on the asp.net
checkbox control will appear in the <span> element.....    As for this
problem, I used to use the "onclick" event instead since each time the
"onclick" event occur, the checkbox's <span> will also notify its child
element and cause the <input checkbox> also change status....  You can have
a try on this to see whether it helps.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: <rlrcstr@newsgroups.nospam>
| References: <uGRi02nAGHA.3***@TK2MSFTNGP10.phx.gbl>
<1134767937.005275.281***@o13g2000cwo.googlegroups.com>
| Subject: Re: Client Side Checkbox Code
| Date: Fri, 16 Dec 2005 16:32:45 -0500
| Lines: 12
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| Message-ID: <O60gChoAGHA.3***@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 198.160.134.100
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365409
Show quote
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| The code never runs when the checkbox is clicked...  I ended up using the
| server side event.
|
| "Remy" <rblaett***@hotmail.com> wrote in message
| news:1134767937.005275.281860@o13g2000cwo.googlegroups.com...
| > <Span> should not be an issue. Is it not working that way? I often add
| > my OnChange events into span blocks.
| >
| > Remy
| >
|
|
|
Author
21 Dec 2005 2:18 PM
Steven Cheng[MSFT]
Hi Jerry,

Does the suggestion in my last reply helps you a little, if there're
anything else we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


--------------------
| X-Tomcat-ID: 51533511
| References: <uGRi02nAGHA.3***@TK2MSFTNGP10.phx.gbl>
<1134767937.005275.281***@o13g2000cwo.googlegroups.com>
<O60gChoAGHA.3***@TK2MSFTNGP09.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: stch***@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Mon, 19 Dec 2005 03:21:47 GMT
| Subject: Re: Client Side Checkbox Code
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <zkaIftEBGHA.1***@TK2MSFTNGXA02.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 50       
| Path: TK2MSFTNGXA02.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:365623
Show quote
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi Jerry,
|
| The ASP.NET CheckBox control is a customized one compared to the raw html

| <input type=checkbox....> element. So it use a <span> to wrapper the
<input
| type=checkbox> and a <label> (normal html checkbox dosn't have text
| ......).  Thus, all the serverside attributes we apply on the asp.net
| checkbox control will appear in the <span> element.....    As for this
| problem, I used to use the "onclick" event instead since each time the
| "onclick" event occur, the checkbox's <span> will also notify its child
| element and cause the <input checkbox> also change status....  You can
have
| a try on this to see whether it helps.
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
| --------------------
| | From: <rlrcstr@newsgroups.nospam>
| | References: <uGRi02nAGHA.3***@TK2MSFTNGP10.phx.gbl>
| <1134767937.005275.281***@o13g2000cwo.googlegroups.com>
| | Subject: Re: Client Side Checkbox Code
| | Date: Fri, 16 Dec 2005 16:32:45 -0500
| | Lines: 12
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
| | Message-ID: <O60gChoAGHA.3***@TK2MSFTNGP09.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: 198.160.134.100
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| | Xref: TK2MSFTNGXA02.phx.gbl
| microsoft.public.dotnet.framework.aspnet:365409
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | The code never runs when the checkbox is clicked...  I ended up using
the
| | server side event.
| |
| | "Remy" <rblaett***@hotmail.com> wrote in message
| | news:1134767937.005275.281860@o13g2000cwo.googlegroups.com...
| | > <Span> should not be an issue. Is it not working that way? I often add
| | > my OnChange events into span blocks.
| | >
| | > Remy
| | >
| |
| |
| |
|
|

AddThis Social Bookmark Button