|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Client Side Checkbox CodeI 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 <Span> should not be an issue. Is it not working that way? I often add
my OnChange events into span blocks. Remy The code never runs when the checkbox is clicked... I ended up using the
server side event. Show quoteHide 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 > 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> <1134767937.005275.281***@o13g2000cwo.googlegroups.com>| References: <uGRi02nAGHA.3***@TK2MSFTNGP10.phx.gbl> | Subject: Re: Client Side Checkbox Code microsoft.public.dotnet.framework.aspnet:365409| 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 Show quoteHide 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 | > | | | 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 <1134767937.005275.281***@o13g2000cwo.googlegroups.com> | References: <uGRi02nAGHA.3***@TK2MSFTNGP10.phx.gbl> <O60gChoAGHA.3***@TK2MSFTNGP09.phx.gbl> | MIME-Version: 1.0 microsoft.public.dotnet.framework.aspnet:365623| 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 Show quoteHide 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 | | > | | | | | | | |
Other interesting topics
help please on GridView commands + AutoEventWireUp, firing twice etc...
Flash Movie (.swf) does not work on localhost Basics of Forma Layout Eliminate postback effect? Long Running Process Trouble with Process.start in my web application... Highlighting DropDownList Items Running client commands from asp.net app datagrid paging GridView DataKey |
|||||||||||||||||||||||