By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 801 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Client Side Checkbox Code

P: n/a
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
Dec 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
<Span> should not be an issue. Is it not working that way? I often add
my OnChange events into span blocks.

Remy

Dec 16 '05 #2

P: n/a
The code never runs when the checkbox is clicked... I ended up using the
server side event.

"Remy" <rb********@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
<Span> should not be an issue. Is it not working that way? I often add
my OnChange events into span blocks.

Remy

Dec 16 '05 #3

P: n/a
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: <rl*****@newsgroups.nospam>
| References: <uG**************@TK2MSFTNGP10.phx.gbl>
<11**********************@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: <O6**************@TK2MSFTNGP09.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: 198.160.134.100
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP09.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" <rb********@hotmail.com> wrote in message
| news:11**********************@o13g2000cwo.googlegr oups.com...
| > <Span> should not be an issue. Is it not working that way? I often add
| > my OnChange events into span blocks.
| >
| > Remy
| >
|
|
|

Dec 19 '05 #4

P: n/a
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: <uG**************@TK2MSFTNGP10.phx.gbl>
<11**********************@o13g2000cwo.googlegroups .com>
<O6**************@TK2MSFTNGP09.phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@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: <zk**************@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
| 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: <rl*****@newsgroups.nospam>
| | References: <uG**************@TK2MSFTNGP10.phx.gbl>
| <11**********************@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: <O6**************@TK2MSFTNGP09.phx.gbl>
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | NNTP-Posting-Host: 198.160.134.100
| | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP09.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" <rb********@hotmail.com> wrote in message
| | news:11**********************@o13g2000cwo.googlegr oups.com...
| | > <Span> should not be an issue. Is it not working that way? I often add
| | > my OnChange events into span blocks.
| | >
| | > Remy
| | >
| |
| |
| |
|
|

Dec 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.