开发者

Problem with collection class using as datasource in asp.net

I am using collection class to work as datasource for gridview. Please download nopCommerce source from http://nopCommerce.com. I am following the same approach.

I have created my providers and collection classes being used as datasources for gridview. The data is binding perfectly. The problem is that i have to customize all the events for gridview like "RowDeleting", "RowUpdating", "R开发者_运维知识库owCancellingEdit" etc. Above all the page is postback if i am clicking on edit, update or select buttons.

Can someone provide proper solution.

Thanks for sharing your time.

Regards Mohammad Irfan


I don't see anything that isn't working correctly. Because a collection is a "simple" object you have to implement these methods as the GridView does not know how to make these changes to a collection of objects.

You might think about creating your own DataSource control.


Are you checking if the page is posting back before you Bind your data?

i.e.:

protected void Page_Load(object sender, EventArgs e)
{

    if(!IsPostBack)
    {
         BindGridView();

    }

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜