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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:21:43+00:00 2026-06-16T18:21:43+00:00

I want a gridview that having ACCEPT button then after clicking it. I want

  • 0

I want a gridview that having “ACCEPT” button then after clicking it. I want the accepted record to be moved or transferred in another gridview which is located in another page?

I already have two gridviews:

Gridview1 named PendingRecordsGridview.
Gridview2 named AcceptedRecordsGridview.

I already made a register.aspx page that after clickng register button, It will send the data in PendingRecordsGridview. And It works! And now, Like i said. I want to add “ACCEPT” button in that gridview, so after clicking the accept button. The record will be transfer to AcceptedRecordsGridview (another page) please! Help!

  • 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-16T18:21:44+00:00Added an answer on June 16, 2026 at 6:21 pm

    Refer this.. i have tested it..

    things you have to keep in mind..

    1. you have to create two different tables for your two gridview.. but those table design should be same of tbl1 and tbl2.. in tbl1 make one field as primarykey and make it auto-incremented

    2. don’t keep any primarykey or and auto-incremented field in tbl2

    here on accept button first data will be inserted in to tbl2 and then delete from original table tbl1
    page.aspx file

                <asp:GridView ID="PendingRecordsGridview" runat="server" 
            AutoGenerateColumns="False" DataKeyNames="id"
            onrowcommand="PendingRecordsGridview_RowCommand">
            <Columns>
                <asp:TemplateField HeaderText="Accept">
                    <ItemTemplate>
                        <asp:Button CommandArgument='<%# Bind("id") %>' ID="Button1" runat="server" CausesValidation="false" 
                            CommandName="accept" Text="Accept" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="name" SortExpression="name">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("name") %>'></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="id" SortExpression="id">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("id") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="sd1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT * FROM [tbl1]"></asp:SqlDataSource>
    

    now page.aspx.cs file

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bind();
        }
    }
    protected void bind()
    {
        PendingRecordsGridview.DataSource = sd1;
        PendingRecordsGridview.DataBind();
    }
    protected void PendingRecordsGridview_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "accept")
        {
            Session["id"] = e.CommandArgument.ToString();
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    
            con.Open();
                SqlCommand cmd1 = new SqlCommand("INSERT INTO tbl2 (id, name) SELECT id, name FROM tbl1 where id='"+Session["id"].ToString()+"'", con);
                SqlCommand cmd2 = new SqlCommand("delete from tbl1 where id='"+Session["id"].ToString()+"'", con);
                cmd1.ExecuteNonQuery();
                cmd2.ExecuteNonQuery();
                bind();
    
        }
    }
    

    now just take another page.. and bind it with tbl2 which will be having records which are approved…

    feel free to ask regarding this.. and mark it as answer if u found it helpful

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

Sidebar

Related Questions

want to have a Hyperlink-Button in a gridView in which I can display a
I want to add a column to a gridview which contains button control. I
I am having a GridView in my page , I want that when a
I want the gridview SelectedRowStyle and EditRowStyles to be mutually exclusive so that the
Hi i m using GridView with hovermenu and i want that when we click
I want to get the function that only refreshes one cell of GridView Currently
I'm having issues using a GridView as a ListView's View, what I want to
I want to make a GridView that contains randomly colored squares, and I want
I have a Linq query that returns an anonymous type, which I then use
I have a asp gridview with button field column on that button click I

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.