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 7755289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:31:50+00:00 2026-06-01T12:31:50+00:00

I have a gridview with Template field. I add a checkbox in templatefield .

  • 0

I have a gridview with Template field. I add a checkbox in templatefield . Autopostback is true for checkbox .

I fill grid in Load-page and creted column dynamic .

 if (!IsPostBack)
        {
         FillGrid();
        }

I use update panel

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
 <ContentTemplate>
<SharePoint:SPGridView ID="grid" AllowSorting="true" AllowFiltering="true"    CssClass="ms-listviewtable"  
runat="server" AutoGenerateColumns="false">
<RowStyle CssClass="ms-alternating" Height="10px" />
<Columns>
    <asp:TemplateField> 
        <ItemTemplate  >
            <asp:CheckBox ID="select" runat="server" 
                OnCheckedChanged="select_CheckedChanged" AutoPostBack="true"  />
            <input id="Display" type="hidden" runat="server" />
            <input id="itemID" type="hidden" runat="server" />
            <asp:Image ID="icon" runat="server" Height="10px" Visible="false"  />
        </ItemTemplate>
        <ItemStyle Width="35px" />
    </asp:TemplateField>
    <asp:TemplateField >
     </asp:TemplateField>
</Columns>
</SharePoint:SPGridView>
 </ContentTemplate>
  <Triggers>
<asp:AsyncPostBackTrigger ControlID="select" EventName="OnCheckedChanged" />
 </Triggers>
 </asp:UpdatePanel>

but show error :A control with ID ‘select’ could not be found for the trigger in UpdatePanel ‘UpdatePanel1’.

My problem is : When checkbox is change, page refresh

I don’t want to refresh page after checkedchange!

  • 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-06-01T12:31:52+00:00Added an answer on June 1, 2026 at 12:31 pm

    First of all you need changes templetecolumn as below

    <asp:TemplateField>
                <ItemTemplate>
                    <asp:CheckBox ID="chkselect" runat="server" />
                    <input id="Display" type="hidden" runat="server" />
                    <input id="itemID" type="hidden" runat="server" />
                    <asp:Image ID="imgicon" runat="server" Height="10px" Style="display: none;" ImageUrl="~/images/arrow_left.jpg" />
                </ItemTemplate>
                <ItemStyle Width="35px" />
            </asp:TemplateField>
    

    Now handle itemdatabound event in server side code

    Protected Sub SPGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvBanner.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim chkselect As CheckBox = e.Row.FindControl("chkselect")
            Dim imgicon As Image = e.Row.FindControl("imgicon")
            If chkselect IsNot Nothing Then
                chkselect.Attributes.Add("onclick", "javascript:DoMyTask(this,'" + imgicon.ClientID + "')")
            End If
        End If
    End Sub
    

    Now specify JavaScript function in aspx page as below.

    <script type="text/javascript" language="javascript">
        function DoMyTask(obj, imgid) {            
            var objCheck = obj.checked;
            var objimg = document.getElementById(imgid)
            if (objCheck == true) {
                objimg.style.display = "block";
                //set more attributes over here
            }
            else {
                objimg.style.display = "none";
                //set more attributes over here
            }
            var count = $(":checkbox:checked").length;
            alert('you have selected ' + count + ' Rows');
        }
    
    </script>
    

    Hope this will help you…happy coding ..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this template field inside a gridview. <asp:TemplateField ItemStyle-HorizontalAlign=Center> <ItemTemplate> <asp:ImageButton ID=ImageButton2 ImageUrl=~/images/DeleteRecord.gif
I have a gridview that I have added a checkbox column using a templatefield
I dynamically create gridview, and in this grid I have template field also field.HeaderTemplate
I have a GridView on an ASP.NET page with a TemplateField column that has
I have a gridview that has a template field containing a checkbox as one
I have a GridView that I need to dynamically add TemplateField elements to. My
I have a button inside of a gridview's template field. Onclick i want to
I have a traditional ASP.NET GridView. Inside of it I have a Template Field
I have a Gridview with ImageButtons added to a column via a templatefield. I've
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:

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.