Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 22nd, 2006, 05:49 AM
Authorized User
 
Join Date: Jan 2006
Location: gangtok, Sikkim, India.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default retaining values of controls inside a datagrid

Hi,
   i wanted to know how to retain the values of the web controls inside a datagrid.....there are a number of web controls inside a datagrid....if a put the method bindToGrid() inside the if(!Page.IsPostBack) then the values are being lost...
I have done this:
datagrid.DataSource=datatable;
datagrid.DataBind();
ProjectDetails projectdetail=new ProjectDetails();
DataTable[] datatable=new DataTable[5];
datatable[0]=projectdetail.getEmployeeProjectDetails(empId);
datatable[1]=projectdetail.getProjectName();
datatable[2]=projectdetail.getProjectManagerNames();
int i=0;
foreach(DataGridItem dgItem in grdProjectDetails.Items)
{
cboProjectName[i]=(DropDownList)dgItem.FindControl("cboProjects");
cboManagerName[i]=(DropDownList)dgItem.FindControl("cboManager");
releasedate[i]=(Aztec.Web.UI.WebControl.DatePicker.DatePickerCon trol)dgItem.FindControl("releaseDate");
chkIfBillable[i]=(CheckBox)dgItem.FindControl("chkAllBillable");
cboIfAvailable[i]=(DropDownList)dgItem.FindControl("cboAllAvailable ");
Rolloverdate[i]=(Aztec.Web.UI.WebControl.DatePicker.DatePickerCon trol)dgItem.FindControl("rollOverDate");
DataRow rows=datatable[0].Rows[i];
if(cboProjectName[i].DataValueField=="")
{
 cboProjectName[i].DataSource=datatable[1];
 cboProjectName[i].DataTextField= "projectName";
 cboProjectName[i].DataValueField= "projectId";
 cboProjectName[i].DataBind();
 cboProjectName[i].SelectedValue=rows[6].ToString();
}
if(cboManagerName[i].SelectedValue=="")
{
  cboManagerName[i].DataSource=datatable[2];
  cboManagerName[i].DataTextField= "empName";
  cboManagerName[i].DataValueField= "empId";
  cboManagerName[i].DataBind();
  cboManagerName[i].SelectedValue=rows[7].ToString();
}
if(releasedate[i].Text=="")
{
 releasedate[i].Text=rows[3].ToString();
}
if(rows[2].ToString()=="Yes")
{
 chkIfBillable[i].Checked=true;
}
else
{
 chkIfBillable[i].Checked=false;
}
if(rows[4].ToString()=="Available")
{
 cboIfAvailable[i].SelectedIndex=0;
 Rolloverdate[i].Text=rows[5].ToString();
}
else
{
 cboIfAvailable[i].SelectedIndex=1;
 Rolloverdate[i].Text="";
}
rowsId[i]=int.Parse(rows.ToString());
i++;
}

Now what happens is that when a press a button and the page is refreshed all the values of the arrays are lost. I have declared these arrays globally and initialized them on page load...


achhetri
__________________
achhetri
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
How to get to controls inside DataList? rsearing ASP.NET 2.0 Basics 1 March 1st, 2007 09:14 AM
find all the controls inside any table amartya_mandal ASP.NET 1.0 and 1.1 Professional 10 October 24th, 2006 08:35 AM
my session variables not retaining values nidhimittal Beginning PHP 4 July 7th, 2006 12:33 AM
my session variables not retaining values nidhimittal PHP How-To 5 June 22nd, 2006 12:35 AM



All times are GMT -4. The time now is 12:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.