当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Get current gridview.rows.count

问题描述:

I have a gridview where I set the datasource when the user click a button on the form.

Im trying to get the rowcount of the gridview using the same button_click event, but its returning the rowcount previous to the datasource being set, ie 0.

Im using

strCount = gvReturned.Rows.Count.Tostring();

Any hints appreciated.

thanks

T

网友答案:

Try listening to the DataSourceChanged event

网友答案:

Try calling

   gvReturned.DataBind() 

after setting the source but before requesting the count..

分享给朋友:
您可能感兴趣的文章:
随机阅读: