Click here to Skip to main content
11,802,442 members (70,932 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET Controls
i have table with only table heads in run-time generate and add rows of controls (dropdownlist-textbox-labels) to my table when enter data in these controls and click save click event code like

for (int iRow = 1; iRow < Table1.Rows.Count; iRow++)
          for (int iCol = 1; iCol <= 8; iCol++)
              if (Table1.Rows[iRow].Cells[iCol].Controls.Count > 0)
                  DropDownList odocType = (DropDownList)grid_Doc.Rows[iRow].Cells[iCol].Controls[0];
                  oImage.DocType =MainClass.GetInteger( odocType.SelectedValue);

i found Table1.Row =1 (th) when searched about these problem i found that page life cycle erase my controls created at runt-time when loop through my table i didn't found all row and controls can any one help me plz
Posted 3-Nov-12 21:05pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try to use the Session, as described in the ASP.NET Session State Overview MSDN topic.

nagiub2007 at 4-Nov-12 3:18am
tnks 4 replay how to use it in my case
Shmuel Zang at 4-Nov-12 3:45am
Just store your data in your pages's Session property (something like: Session["MyEnteryName"] = myEntry;) and, read it in the next cycle (something like: myEntry = Session["MyEnteryName"];).
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You need to use one of the state management techniques to implement it:
MSDN: ASP.NET State Management Overview[^]
State management in ASP.NET - 1[^]
ASP.Net State Management Techniques - 2[^]

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

  Print Answers RSS
0 KrunalRohit 366
1 OriginalGriff 365
2 F-ES Sitecore 295
3 Afzaal Ahmad Zeeshan 230
4 CPallini 230
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,645
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web04 | 2.8.151002.1 | Last Updated 4 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100