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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:30:11+00:00 2026-05-20T17:30:11+00:00

I have used update panel and in that update panel I have kept ASP

  • 0

I have used update panel and in that update panel I have kept ASP Table control in which I am creating rows dynamically which in turn contains 1 dropdown lists and 3 text boxes. My problem is that after partial postback text boxes and dropdown list are found but text property of text boxes is showing empty and dropdown list’s selected value is set to the first record in that box. I have also stored entire table in session and retrieve it in(!isPostBack) condition at page_load event. Please guide me how to resolve this problem?

part of my .aspx page is as below

<td colspan="2">
               <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server" EnableViewState="true">
                <ContentTemplate>  
                  <table class="style1">
                   <tr>
                     <td>
                        <table class="style1" border="1">
                        <tr>
                           <td width="120">
                                <asp:Label ID="QualificationLbl" runat="server" Text="Qualification"></asp:Label>                                           </td>
                                            <td  width="100">
                                                <asp:Label ID="PercentageLbl" runat="server" Text="Percentage"></asp:Label>
                                            </td>
                                            <td width="100">
                                                <asp:Label ID="YearLbl" runat="server" Text="Passing Year"></asp:Label>
                                            </td>
                                            <td width="*">
                                                <asp:Label ID="InstituteLbl" runat="server" Text="Institute Name" Width="120px" 
                                                    onprerender="InstituteLbl_PreRender"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="4" align="left">
                                                <asp:PlaceHolder ID="PlaceHolder" runat="server"></asp:PlaceHolder>
                                                <asp:Table ID="Table1" runat="server">
                                                </asp:Table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Button ID="addRowBtn" runat="server" onclick="addRowBtn_Click" 
                                        Text="Add New Row" />
                                </td>
                            </tr>
                        </table>
                  </ContentTemplate>
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="addRowBtn" EventName="Click" />
                    </Triggers>

            </asp:UpdatePanel>
            <br />
    </td>

and My .aspx.cs page is as below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using AppResumeMaster;
using AppQualificationDetail;


public partial class Applicant_ApplicationForm : System.Web.UI.Page
{
    int Rows = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
    if (!IsPostBack)
    {
        generateTable(Rows);
    }
    else
    {
        Table ReturnedTable = new Table();
        ReturnedTable = (Table)Session["Table"];
        int rowCount = ReturnedTable.Rows.Count;
        int colCount = 4;

        DropDownList objList = new DropDownList();
        TextBox txtBox = new TextBox();
        if (ReturnedTable != null)
        {
            for (int Rcount = 0; Rcount < rowCount; Rcount++)
            {
                for (int Ccount = 0; Ccount < colCount; Ccount++)
                {
                    if (Ccount == 0)
                    {
                        objList = (DropDownList)ReturnedTable.Rows[Rcount].Cells[Ccount].FindControl("DropDownList(" + Rcount + "," + Ccount + ")");
                        objList.SelectedValue = ((DropDownList)ReturnedTable.Rows[Rcount].Cells[Ccount].FindControl("DropDownList(" + Rcount + "," + Ccount + ")")).SelectedValue;
                    }
                    else
                    {
                        txtBox = (TextBox)ReturnedTable.Rows[Rcount].Cells[Ccount].FindControl("TextBox(" + Rcount + "," + Ccount + ")");
                        txtBox.Text = ((TextBox)ReturnedTable.Rows[Rcount].Cells[Ccount].FindControl("TextBox(" + Rcount + "," + Ccount + ")")).Text;
                        //txtBox.Text = Request.Params["TextBox(" + Rcount + "," + Ccount + ")"];
                    }
                }
            }

        }
    }

}
protected void saveBtn_Click(object sender, EventArgs e)
{
}
protected void addRowBtn_Click(object sender, EventArgs e)
{

    if (ViewState["rowCount"] != null)
    {
        Rows = Convert.ToInt32(ViewState["rowCount"].ToString());
        generateTable(Rows);
    }

}
public void generateTable(int rowCount)
{
    try
    {
        int colCount = 4;
        DropDownList objDropDownList;
        for (int Row = 0; Row < rowCount; Row++)
        {
            TableRow objTablerow = new TableRow();

            for (int cols = 0; cols < colCount; cols++)
            {
                TableCell objTableCell = new TableCell();
                if (cols == 0)
                {
                    objDropDownList = new DropDownList();
                    objDropDownList.Width = 120;
                    objTableCell.Controls.Add(objDropDownList);

                    DataOperation objDataoperation = new DataOperation();
                    DataSet ds = new DataSet();
                    ds = objDataoperation.DropDownList("select * from tblQualificationMaster");

                    objDropDownList.DataValueField = ds.Tables[0].Columns[0].ToString();
                    objDropDownList.DataTextField = ds.Tables[0].Columns[1].ToString();
                    objDropDownList.DataSource = ds.Tables[0];
                    objDropDownList.DataBind();

                    objDropDownList.ID = "DropDownList(" + Row + "," + cols + ")";
                    objTableCell.Controls.Add(objDropDownList);
                    objTablerow.Controls.Add(objTableCell);
                }
                else
                {
                    TextBox objTextBox = new TextBox();
                    objTextBox.ID = "TextBox(" + Row + "," + cols + ")";
                    objTableCell.Controls.Add(objTextBox);
                    objTablerow.Controls.Add(objTableCell);
                }
            }

            Table1.Rows.Add(objTablerow);

        }
        rowCount++;
        ViewState["rowCount"] = rowCount;
    }
    catch (Exception ex)
    {
        throw ex;
    }
}
protected void InstituteLbl_PreRender(object sender, EventArgs e)
{
    Session.Add("Table", Table1);
}
}

I want to add one row on every addRowTbn click event there by retaining previous rows.

  • 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-20T17:30:12+00:00Added an answer on May 20, 2026 at 5:30 pm

    From my first look through, you are trying to pull drop down’s selected value and the text box’s text value from the table you stored in session, but you stored that table in session prior to the user having the opportunity to make changes to the values.

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

Sidebar

Related Questions

I have an ASP.NET 4 webpage that contains an update panel which just allows
We currently have a WebForms control with an update panel. The code-behind contains logic
I have used an update command to update the whole table in an Sql
I have a form which is used to insert/display and update . In the
I have an update panel on my page with some links that have onClick
I have an ASP.NET page that contains two div's. Both have search fields and
I have used LINQ to SQL with a update stored procedure to update databases
I have several update methods in a javascript file, used for updating my ajax
I have used traditional version control systems to maintain source code repositories on past
I have used Photoshop CS2's Save for Web feature to create a table of

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.