Could you let me know which event handler have you put your code in? You can see the data when it is loaded at Page_Load event. But when you click a button to post it back, the data might be lost since the whole page is reloaded.
You have to make sure that DataBind() method is called before you check for row count.
Sincerely,
Kevin Yu
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Mark as Not Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Kevin Yu - M...
All-Star
19021 Points
1467 Posts
Re: datagrid.Items.Count to GridView.Rows.Count
Jun 25, 2007 07:25 AM|LINK
Hi Bill,
Could you let me know which event handler have you put your code in? You can see the data when it is loaded at Page_Load event. But when you click a button to post it back, the data might be lost since the whole page is reloaded.
You have to make sure that DataBind() method is called before you check for row count.
Kevin Yu
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Mark as Not Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.