Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6837431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:28:35+00:00 2026-05-26T23:28:35+00:00

i have a grid view in which i have placed the checkbox in itemtemplate

  • 0

i have a grid view in which i have placed the checkbox in itemtemplate

i want only the one checkbox is selected from Gridview to select that perticular row so that i can use that id to edit or delete the row

aspx page code is

            <asp:TemplateField Visible="false">
                <ItemTemplate>
                    <asp:Label ID="lblId" runat="server" Text='<%#Eval("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Select
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="chkSelect" runat="server"/>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Branch Name
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblBranch_Name" runat="server" Text='<%# Bind("Branch") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    Address
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblAddress" runat="server" Text='<%# Eval("Address") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    City
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblCity" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>

        </Columns>

and i want when i click on the checkbox which is at first of each row only one check box is selected from all the rows

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:28:35+00:00Added an answer on May 26, 2026 at 11:28 pm

    you can do like this…..with single check box selection using jquery….

    ASPX CODE

    <table id="GirdViewTable">
    <tr>
    <td>
    <asp:GridView ID="gvLeave" runat="server" AlternatingRowStyle-CssClass="Col2" AutoGenerateColumns="False"
    CellSpacing="1" GridLines="None" Height="100%" PageSize="25" Width="100%">
    <RowStyle CssClass="Col1" />
    <HeaderStyle CssClass="TdTitle" ForeColor="White" />
    <Columns>
    <asp:BoundField DataField="leaveName" HeaderText="Leave" />
    <asp:BoundField DataField="leaveCode" HeaderText="Code" />
    <asp:BoundField DataField="days" HeaderText="Days" />
    <asp:TemplateField>
    <HeaderStyle HorizontalAlign="Left" />
    <ItemStyle HorizontalAlign="Left" />
    <ItemTemplate>
    <asp:CheckBox ID="chkLeave" runat="server" onclick="toggleSelectionGrid(this);" />
    <asp:Label ID="lblLeaveID" runat="server" Text='<% #Eval("leaveID") %>' Visible="false"></asp:Label>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    <AlternatingRowStyle CssClass="Col2" />
    </asp:GridView>
    </td>
    </tr>
    </table>
    

    Bind Grid

    private void BindLeaveMaster()
    {
         DataTable dt = HREmpLeave.GetSearch(null, null, null, null, true, null, null, null, null).Tables[0];
         try
         {
              if (dt.Rows.Count > 0)
              {
                   gvLeave.DataSource = dt;
                   gvLeave.DataBind();
              }
              else
              {
                   gvLeave.DataSource = null;
                   gvLeave.DataBind();
              }
         }
         catch (Exception oException)
         {
               oException.Message.ToString();
         }
         finally
         {
              dt = null;
        }
    }
    

    Page_Load

    if (!IsPostBack)
    { 
          BindLeaveMaster();
    }
    

    JQuery Script

    <script type="text/javascript" src="Script/jquery-1.5.1min.js"></script>
    
    <script type="text/javascript" language="javascript">
    
    function toggleSelectionGrid(source) 
    {
       var isChecked = source.checked;
       $("#GirdViewTable input[id*='chkLeave']").each(function(index) {
       $(this).attr('checked', false);
    });
      source.checked = isChecked;
    }
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView in which each row has a custom view. The grid
i have a grid view which contain images when click on one image it
i have a grid-view, which contains an asp image-button for deleting row, i want
I have a grid view which uses SQL to calculate information that I need!
I have GridView which I can select a row. I then have a button
I have a gridview which is databound, I want to dynamically add a row
I have a GridView which is databound to an XML Datasource. For one of
Have a gridview control which will show X amount of rows. I want to
I have a GridView to which I bind a dataTable that I manually created.
Hi I have a grid view which is dynamically generated via C# using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.