Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 29th, 2007, 02:25 AM
Authorized User
 
Join Date: Jun 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default CheckBox onClick event

Hi,
I want to call a javascript fuction on clicking a checkbox. I have written the foll. piece of code but it does not work.

<table id="Table1" cellSpacing="0" cellPadding="0" width="100%" border="0" runat="server">
<tr vAlign="top">
<td vAlign="top"><asp:datalist id="list1" Runat="server" width="100%" RepeatDirection="Horizontal" EnableViewState="True"
                                OnItemDataBound="list1_ItemDataBound">
                                <ItemStyle width="210px" Wrap="True"></ItemStyle>
                                <ItemTemplate>
                                    <asp:CheckBox id=chkBox1 onClick="javascript:SelectedChkBoxCount(this.id,'l ist1');" Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Produ ctName").ToString()%>' EnableViewState=True >
                                    </asp:CheckBox>
                                </ItemTemplate>
                            </asp:datalist></td>
</tr>
</table>


Please help me.

 
Old August 29th, 2007, 02:43 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, I have checked the code at my end, & its working fine. Just an idea that the javascript method might be throwing any error, plz post the javascript method, and the position where you have written this javascript method, (if possible the complete user control code).

Regards
Mike

Don't expect too much, too soon.
 
Old August 29th, 2007, 02:51 AM
Authorized User
 
Join Date: Jun 2007
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
The javascript code is

<script language="javascript">
function SelectedChkBoxCount(chkBoxId,listId)
{
    alert("try");
    //alert(document.all[listId].rows.length);
}

</script>

 
Old August 29th, 2007, 03:02 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well, it again works at my end, is this page being opened in a pop up window? If not, do you find any javascript error at the bottom left hand corner of the IE?

(If this page is opening in a pop up window, first open this in a normal window by copying the URL of the pop up window, and then check for the error at the bottom left hand corner of the IE)

Regards
Mike

Don't expect too much, too soon.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Onclick Post event sabu21s Classic ASP Databases 0 October 31st, 2005 05:43 PM
onclick event bjackman Access 6 July 15th, 2004 06:54 AM
onclick event pigtail Javascript 1 April 11th, 2004 03:10 PM
Setting Checkbox Checked Property from OnClick saturdave ASP.NET 1.0 and 1.1 Basics 2 April 8th, 2004 09:33 AM
onClick Event mateenmohd Javascript 4 December 16th, 2003 01:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.