Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Jquery click checkbox
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
tshad  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 10:04
Newsgroups: microsoft.public.dotnet.framework.aspnet
From: "tshad" <t...@dslextreme.com>
Date: Sun, 8 Nov 2009 02:04:36 -0800
Local: Sun 8 Nov 2009 10:04
Subject: Jquery click checkbox
Is there a way to use JQuery to select a checkbox in a GridView object?

You can use it to select rows or highlight rows.

But I am trying to Select a GridRow that I can handle in my C# code later
during postback.

I would like to be able to drag select if possible (Select the rows by
holding down the mouse, drag down a few rows which are highlighted and
select all the boxes that are selected).

Can this be done in JQuery?

I can select a row doing the following but that doesn't check the box.
**********************************************************
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="SelectorTest.aspx.cs" Inherits="MyNamespace.SelectorTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
    <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
    $(document).ready(function()
    {

        $("tr").filter(function()
        {
            return $('td', this).length && !$('table', this).length
        }).click(function()
        {
            $(this).toggleClass('currRow');
        });

    });
</script>

<style type="text/css">
    .currRow
    {
        background-color:Gray;
        cursor:pointer;
    }
</style>

</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False"
DataKeyNames="CustomerID"
        DataSourceID="SqlDataSource1">
        <Columns>
            <asp:BoundField DataField="CustomerID" HeaderText="CustomerID"
ReadOnly="True"
                SortExpression="CustomerID" />
            <asp:BoundField DataField="CompanyName" HeaderText="CompanyName"
                SortExpression="CompanyName" />
            <asp:BoundField DataField="ContactName" HeaderText="ContactName"
                SortExpression="ContactName" />
            <asp:BoundField DataField="Address" HeaderText="Address"
                SortExpression="Address" />
            <asp:BoundField DataField="City" HeaderText="City"
SortExpression="City" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:CheckBox ID="chkChoice" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
     <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString
%>"
        SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName],
[Address], [City] FROM [Customers]">
    </asp:SqlDataSource>
   </form>
</body>
</html>
************************************************************************

Thanks,

Tom


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google