Datagrid lose Items in Postback

A

Amir

Hi all
I have only a Datagrid and a submit button on a form.
I use 2 template columns and some bounded columns in my grid too.

I just want to process Datagrid's items in a for loop in the event handler
of Button click.
My loop look like this:
for(int i=0;i<dg.Items.Count;i++)
{
....
}

but "dg.Items.Count" after postback is ZERO when I debug the code.
It's not zero in Page_load method after postback.
 
A

Amir

execute the code in the page_load.
Irene, It find also the ItemCommand's event handler. but my code can not
count the Datagrid's items. because DG.Items.Count is ZERO in the event
handler.

It's very amazing that it's not ZERO in page_load when I debug my code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top