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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:36:06+00:00 2026-05-19T04:36:06+00:00

I have a gridview with these columns: id,name,price,quantity,total. Also i have a button and

  • 0

I have a gridview with these columns: id,name,price,quantity,total. Also i have a button and checkbox in every row of gridview. When i check some rows i would like these rows with the button to transfer in another gridview.How can i do that?

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="id" DataSourceID="SqlDataSource3">


        <Columns>
                        <asp:TemplateField>
                <ItemTemplate>
                    <asp:CheckBox ID="chkSelect" runat="server" />
                    <asp:HiddenField ID="hdValue" runat="server" Value='<%#Eval("ID") %>' />
                </ItemTemplate>
            </asp:TemplateField>

            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="name" HeaderText="name" ReadOnly="True" 
                SortExpression="name" />
            <asp:BoundField DataField="price" DataFormatString="{0:c}" HeaderText="price" 
                ReadOnly="True" SortExpression="price" />
            <asp:BoundField DataField="quantity" HeaderText="quantity" 
                SortExpression="quantity" />
            <asp:BoundField DataField="total" DataFormatString="{0:c}" HeaderText="total" 
                ReadOnly="True" SortExpression="total" />


        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT * FROM [Land]"></asp:SqlDataSource>
</div>
<div>

    <asp:Button ID="Button1" runat="server" Text="Button" />

</div>
  • 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-19T04:36:07+00:00Added an answer on May 19, 2026 at 4:36 am

    While working with data grids, I usually create a class which hold a template for my data, and then I create objects from this class and put in a list, then I can easily bind this list to any grid.

    For example:

    public class LandTemplate
    {
      public property Id{get; set;}
      public property Name{get; set;}
      public property Price{get; set;}
      public property Quantity{get; set;}
      public property Total{get; set;}
    }
    

    Then in your method which in your case will be the click on check box event you can do that:

    List<LandTemplate> landList = new List<LandTemplate>();
    public void CheckBox_Click(object sender, EventArgs e)
    {
       // get data from the current grid row...
    
       LandTemplate land = new LandTemplate();
       land.Id= currentRow.Id;
       land.Name = currentRow.Name;
       ....
    
       landList.Add(land);
    
    }
    
    public void Button_Click(object sender, EventArgs e)
    {
       this.gridView1.DataSource = landList;
           this.gridView1.DataBind();
    }
    

    But you will need to save the LandList in a viewstate or session to don’t loose data inside after every page refresh.

    I didn’t check for syntax, but I hope you got the idea.

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

Sidebar

Related Questions

I have a GridView A that have many columns, one of those contains price
I have GridView which I can select a row. I then have a button
I have a GridView that allows editing the values in every column, in every
Ok... I have a database table called employees.. This has columns called ID, Name,
I have a Gridview with these parameters: <asp:GridView runat=server ID=ItemGrid CssClass=Grid AutoGenerateColumns=false AutoGenerateDeleteButton=true OnRowDeleting=RowDeleting
I have the following columns in a gridview, one is a date and the
I have a GridView control in an Asp.net application, that has a <asp:buttonField> of
I have a GridView where one column is bound to an object property containing
I have a GridView defined like this: <asp:GridView ID=myGridView ruant=server> <asp:BoundField DataField=myField /> <asp:CommandField
I have a gridview like below: <asp:GridView DataKeyNames=TransactionID AllowSorting=True AllowPaging=TrueID=grvBrokerage runat=server AutoGenerateColumns=False CssClass=datatable Width=100%

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.