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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:54:21+00:00 2026-05-18T11:54:21+00:00

Good night, I used the gridviewhelper to group the rows in a gridview. GridViewHelper

  • 0

Good night,

I used the gridviewhelper to group the rows in a gridview.

GridViewHelper helper = new GridViewHelper(this.Resultados);
  helper.RegisterGroup("EntidadeNome", true, true);
  helper.GroupHeader += new GroupEvent(helper_GroupHeader);
  this.Resultados.DataSource = DT;
  this.Resultados.DataBind();

Each row as two itemtemplate, each one with a checkbox.

     <asp:GridView ID="Resultados" runat="server" AutoGenerateColumns="false" GridLines="None"
                        CssClass="mGrid" PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt"
                        ShowHeader="false">
                        <Columns>
                            <asp:BoundField DataField="EntidadeNome" SortExpression="EntidadeNome" />
                            <asp:BoundField DataField="ID" HeaderText="IDLinhascompras" ItemStyle-CssClass="hidden"
                                HeaderStyle-CssClass="hidden" ItemStyle-HorizontalAlign="Center" />
                            <asp:BoundField DataField="Artigo" HeaderText="Artigo" SortExpression="Artigo" ItemStyle-Width="50px"
                                ItemStyle-HorizontalAlign="Center" />
// Some BoundFieds here
                            <asp:TemplateField HeaderText="A" ItemStyle-Width="40px" SortExpression="A">
                                <ItemTemplate>
                                    <asp:CheckBox ID="A" Width="40" runat="server" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="R" ItemStyle-Width="40px" SortExpression="R">
                                <ItemTemplate>
                                    <asp:CheckBox ID="R" Width="40" runat="server" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                        </Columns>
                        <EmptyDataTemplate>
                        <label>Sem resultados para apresentar</label>
                        </EmptyDataTemplate>
                    </asp:GridView>

I’m having some problems when i search for the rows that have a checkbox checked.

    protected void EnviaArtigos_Click(object sender, EventArgs e)
{

    CheckBox chkA, chkR;

    foreach (GridViewRow dataItem in Resultados.Rows)
    {
        object rows;

        chkA = (CheckBox)dataItem.FindControl("A");
        chkR = (CheckBox)dataItem.FindControl("R");

        if (chkA.Checked)
        {
            try
            {
                Motor.DSO.BDAPL.Execute("UPDATE LINHASCOMPRASSTATUS SET ESTADOTRANS = 'A' WHERE IDLINHASCOMPRAS ='" + dataItem.Cells[1].Text + "'", out rows,
                    -1);
                this.Resultados.DataSource = null;
                this.Resultados.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
        if (chkR.Checked)
        {
            try
            {
                Motor.DSO.BDAPL.Execute("UPDATE LINHASCOMPRASSTATUS SET ESTADOTRANS = 'R' WHERE IDLINHASCOMPRAS ='" + dataItem.Cells[1].Text + "'", out rows, -1);
                this.Resultados.DataSource = null;
                this.Resultados.DataBind();
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
    }

I see when debugging, that for some reason the checkbox is checked in the row that have the groupheader, and then, in the row that is effectibly selected, the checkbox is not checked.

So, in few words, how can i bypass the groupheader row and only search the checkboxes in the other rows?

Thank you.

EDIT: The error: Conversion failed when converting from a character string to uniqueidentifier.

  • 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-18T11:54:22+00:00Added an answer on May 18, 2026 at 11:54 am

    Filter out the Header (and optionally the footer) rows by checking the TableSection property of the GridViewRow. The syntax may be slightly off (I mostly do VB), but put something like this after your ForEach declaration…

    If (dataitem.TableSection != TableRowSection.TableHeader) {
    object rows; 
    //Rest of the code goes here...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good morning, afternoon, evening or night (depending on your timezone). This is just a
good night i have a doubt what reason this output doesn't work [{var1:abc},{var2:abcd},{var3:abcde}] but
I've being trying this all night through. Is there any good solution to do
Good Evening, I am pretty new to Unix so maybe this mini project is
Good night all, this is my first question. i got some problem when running
Good night everyone, This question leaves me a little embarassed because, of couse, I
this is my program tran('father','otosan'). tran('father','chichiwe'). tran('mother','okasan'). tran('mother','hahawe'). tran('hi','ohayo'). tran('good night','oyasemi'). tran('good bye','sayonara'). tran('do
Good night, in my application I access my database through Hibernate. I want to
Good Day, Can someone confirm what was said at the bottom of this post
So, I'd like to be able to make a call x = MyClass.new('good morning',

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.