I have a dynamic Gridview inside that gridview i have another inner dynamic gridview.All bindings are done at main grid Rowdatabound.I have an image button in the Main Grid for saving data so i calling main grid rowcommand for saving records,but it is firing
rowdatabound event for each row which is affecting perfomance of my page.Is there any way i can avoid rowdatabound calling while calling rowcommand.
Instead of using RowCommand you can use the event of the control and put your codes for saving there. For example if you are using a Button within a GridView, you can use the Click event of the Button instead.
Also if your main concern is the performance of the grid then you may want to limit the data of the grid per page.I would suggest you to implement custom paging. You can also limit the amount of data to be returned in your query or use sql paging for more
effecient way.
Actually initially i was using button click on but it was calling rowdatabound so I tried rowcommand.. but both behaving in the same way.. this means that whenever i click any button inside main grid it will call rowdatabound of maingrid which again will
bind all records of child and main... there must be something to avoid it..Please help..
it is firing rowdatabound event for each row which is affecting perfomance of my page.Is there any way i can avoid rowdatabound calling while calling rowcommand.
Hi,
RowDataBound event happens after you reset the DataSource and call DataBind() again.
So without doing this this event won't be fired.
But considering you are paging, so you cannot avoid RowDataBound, because you have to reset the datasource for per pag's DataSource and call DataBind() again.
monikaprajap...
0 Points
6 Posts
Want to avoid GridView RowDatabound while firing Rowcommand
Jan 28, 2013 03:11 PM|LINK
I have a dynamic Gridview inside that gridview i have another inner dynamic gridview.All bindings are done at main grid Rowdatabound.I have an image button in the Main Grid for saving data so i calling main grid rowcommand for saving records,but it is firing rowdatabound event for each row which is affecting perfomance of my page.Is there any way i can avoid rowdatabound calling while calling rowcommand.
vinz
All-Star
126916 Points
17922 Posts
MVP
Re: Want to avoid GridView RowDatabound while firing Rowcommand
Jan 29, 2013 06:42 AM|LINK
Instead of using RowCommand you can use the event of the control and put your codes for saving there. For example if you are using a Button within a GridView, you can use the Click event of the Button instead.
Also if your main concern is the performance of the grid then you may want to limit the data of the grid per page.I would suggest you to implement custom paging. You can also limit the amount of data to be returned in your query or use sql paging for more effecient way.
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
monikaprajap...
0 Points
6 Posts
Re: Want to avoid GridView RowDatabound while firing Rowcommand
Jan 29, 2013 01:19 PM|LINK
Thanks for the response ...
Both Button click and Rowcommand are behaving in the same way for me...Button click is also calling RowDataBound..any other ideas which
can help me..Thanks in Advance
vinz
All-Star
126916 Points
17922 Posts
MVP
Re: Want to avoid GridView RowDatabound while firing Rowcommand
Jan 29, 2013 01:28 PM|LINK
Did you removed the rowcommand function when testing the Button click event?
MessageBox Controls for WebForms | Blog | Twitter | Linkedin
monikaprajap...
0 Points
6 Posts
Re: Want to avoid GridView RowDatabound while firing Rowcommand
Jan 29, 2013 08:10 PM|LINK
Actually initially i was using button click on but it was calling rowdatabound so I tried rowcommand.. but both behaving in the same way.. this means that whenever i click any button inside main grid it will call rowdatabound of maingrid which again will bind all records of child and main... there must be something to avoid it..Please help..
Thanks in advance
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Want to avoid GridView RowDatabound while firing Rowcommand
Jan 30, 2013 12:49 AM|LINK
Hi,
RowDataBound event happens after you reset the DataSource and call DataBind() again.
So without doing this this event won't be fired.
But considering you are paging, so you cannot avoid RowDataBound, because you have to reset the datasource for per pag's DataSource and call DataBind() again.