Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 29th, 2007, 02:25 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
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.

  #2 (permalink)  
Old August 29th, 2007, 02:43 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
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.
  #3 (permalink)  
Old August 29th, 2007, 02:51 AM
Authorized User
 
Join Date: Jun 2007
Location: , , .
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>

  #4 (permalink)  
Old August 29th, 2007, 03:02 AM
Friend of Wrox
Points: 1,935, Level: 17
Points: 1,935, Level: 17 Points: 1,935, Level: 17 Points: 1,935, Level: 17
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2004
Location: United Kingdom
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.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:01 PM.


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