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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:18:07+00:00 2026-05-26T10:18:07+00:00

ASP.NET 3.5 & SQL 2008 I have this main table & a subtable. For

  • 0

ASP.NET 3.5 & SQL 2008
I have this main table & a subtable. For each set of calculation, 1 record is added to the main table & several records to the subtotal.

Most of user entered data goes into the subtable & some into the main table.
Currently I have a web page set up with several textboxes to get the data from the user & the resulting calculations are displayed in a gridview.

The gridview shows all the records from the Main table.
Each time the user selects a record from the gridview, I want to invoke another page where the user can change the data for the selected record.

It will be nice if I can display the 1 record from the main tablle & all the related records form the subtable.I don’t want to use free floating textboxes.

What controls will be the easiest to use for such an application?

  • 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-26T10:18:08+00:00Added an answer on May 26, 2026 at 10:18 am

    you can use grid view in two pages it self…

    Here you have to use session variables to store the value of gridview rows in first page then retrieve the session value and display the row in gridview control in the second page.

    If you use gridview control to display the data which get from database in the first page ,as far as I know you can also just pass the unique value of record(such as id) to an other page ,then use the unique value as a condition to search the record in database and display the record by using gridview control in the second page.

    Sample:

    1.Code in the first page(.aspx):

       <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
        <title></title>
       </head>
       <body>
        <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server" 
                onrowdatabound="GridView1_RowDataBound">
            <Columns>
            <asp:TemplateField>
            <HeaderTemplate>PassValue</HeaderTemplate>
            <ItemTemplate>
            <a href='OtherPage.aspx?id=<%# Container.DataItemIndex %>' target="_blank">Pass</a>
            </ItemTemplate>
            </asp:TemplateField>
            </Columns>
            </asp:GridView>
        </div>
        </form>
    </body>
    </html>
    

    2.Code in the first page(.cs):

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
        }
    }
    public void Bind()
    {
        this.GridView1.DataSource = Get_source();
        this.GridView1.DataBind();
    }
    // You can get the datatbale form your own database.
    // I get the datasource like this in order to run the sample convenient.
    public DataTable Get_source()
    {
        DataTable dt = new DataTable();
        DataRow dr;
        string XM = "true,false,false,true";
        string XMM = "1,2,3,4";
        string[] list1 = XM.Split(',');
        string[] list2 = XMM.Split(',');
        dt.Columns.Add(new DataColumn("ActiveStatus"));
        dt.Columns.Add(new DataColumn("number"));
        for (int i = 0; i < list1.Length; i++)
        {
            dr = dt.NewRow();
            dr["ActiveStatus"] = list1[i];
            dr["number"] = list2[i];
            dt.Rows.Add(dr);
        }
        return dt;
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        int i = e.Row.RowIndex;
        Session["row"+i] = e.Row;
    }
    

    3.Code in the second page(which named as OtherPage.aspx)

    OtherPage.aspx:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server">
            </asp:GridView>
        </div>
        </form>
    </body>
    </html>
    

    4.Code in the second page(.cs):

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] != null)
        {
            string i = Request.QueryString["id"].ToString();
            if (Session["row"+i] != null)
            {
                DataTable dt = new DataTable();
                DataRow dr = dt.NewRow();
                GridViewRow row = (GridViewRow)Session["row" + i];
                for (int xm = 0; xm < row.Cells.Count; xm++)
                {
                    dt.Columns.Add(new DataColumn());
                    dr[xm] = row.Cells[xm].Text;
                }
                dt.Rows.Add(dr);
                this.GridView1.DataSource = dt;
                this.GridView1.DataBind();
            }
        }
    }
    

    if you want to modify the data in second page, you can modify … I hope it will helps you…

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

Sidebar

Related Questions

I have a SQL Server 2000, C# & ASP.net web app. We want to
I have a website that is built in ASP.NET 3.5 & SQL Server 2005,
I have a web project (C# Asp.Net, EF 4, MS SQL 2008 and IIS
We have a web based (ASP.NET MVC) application that uses SQL Server 2008 for
The application is planned to be built using ASP.NET, .NET Remoting & MS SQL
I started my project in Asp.net MVC(c#) & SQL Server 2005.I want to implement
I'm using ASP.NET 4, EF 4 and FILESTREAM in SQL 2008 to add/read files
We have developed a vacation rental application in ASP.NET with SQL server as DB.
I am using SQL Server 2008 in a asp.net/c# program. I am trying to
I have renamed a table in a SQL Server 2008 database, from eL_CourseStepUserNotes to

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.