Click here to Skip to main content
15,904,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all,
I have an asp.net web application.In that i have a form,In the form I have

1.) 4 Text box
2.) two combo box
3.) Four buttons


I entered the text in first text box and select the item from those two combobox. Now there is another textbox and a

button named as add in front of it. When clicks on add after entering the text in that text box, the whole entry from the

form disaapears. Actually I have a main button names as save..I wants to save all the information but before that page

loads and all the information become disappears.

How could i hold the text when page load..I am struggling from last 16 days,yet not get the solution...
This is my page load and all Enableviewstate is true for all controls

C#
protected void Page_Load(object sender, EventArgs e)
{
//page load
if (!Page.IsPostBack)
{
//if (Request.QueryString["id"] != null)
//{

//}
//else if (Request.QueryString["id"] == null)
//{
//btnSubmitAll.Visible = true;
//laberror.Visible = false;
//btnUpdate.Visible = false;
//btnUpdatePro.Visible = false;
//btnUpdateRef.Visible = false;
//btnUpdateStatus.Visible = false;

ds1 = con.ExecuteSPDS("TypeOfDll", "0", "ddlDailyReport");
if (ds1.Tables.Count > 0)
{
if (ds1.Tables[1].Rows.Count > 0)
{
ddlProduct.DataSource = ds1.Tables[1];
ddlProduct.DataTextField = "ProductName";
ddlProduct.DataValueField = "Id";
ddlProduct.DataBind();
ddlProduct.SelectedValue = "0";
}

if (ds1.Tables[0].Rows.Count > 0)
{
ddlHOffState.DataSource = ds1.Tables[0];
ddlHOffState.DataTextField = "State";
ddlHOffState.DataValueField = "Id";
ddlHOffState.DataBind();
ddlHOffState.SelectedValue = "0";
}

if (ds1.Tables[2].Rows.Count > 0)
{
ddlref.DataSource = ds1.Tables[2];
ddlref.DataTextField = "Reference";
ddlref.DataValueField = "Id";
ddlref.DataBind();
ddlref.SelectedValue = "0";
}

if (ds1.Tables[3].Rows.Count > 0)
{
ddlstatus.DataSource = ds1.Tables[3];
ddlstatus.DataTextField = "SalesStatus";
ddlstatus.DataValueField = "Id";
ddlstatus.DataBind();
ddlstatus.SelectedValue = "0";
}

if (ds1.Tables[4].Rows.Count > 0)
{
ddlOffType.DataSource = ds1.Tables[4];
ddlOffType.DataTextField = "OffType";
ddlOffType.DataValueField = "Id";
ddlOffType.DataBind();
ddlOffType.SelectedValue = "0";
}
//}

//fill ds for grids//
}

}
if (Request.QueryString["id"] != null)
{
Filleditgrid();
}
else if (Request.QueryString["id"] == null)
{
FillDs();
}


// btnUpdOffContact.Visible = false;

}

[Edit]code block moved from answer[/Edit]
Plz help me
Posted
Updated 29-Mar-11 21:01pm
v2

1 solution

When clicks on add after entering the text in that text box , the whole entry from the form disaapears
Sounds like a postback happened and all gone. Reset to old values.

Either, you have disabled viewstate for the page or controls or you are resetting the control values in your pageload.
Read on: Understanding ASP.NET View State[^]

But, before moving any forward, you need to read on ASP.NET Page Lifecycle[^] and learn on how to use Visual Studio DEBUGGER[^].
This also: Using the DEBUGGER[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900