This is a migrated thread and some comments may be shown as answers.

How to avoid Grid AutoDataBind

2 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 27 Jun 2008, 01:22 PM
Hello

I am using RadGrid  5.1.3.0
I am setting Grid datasource at Page.Load and call Grid's DataBind method; after filling grid's items I explicitly set SelectedItem in a grid. But right after that grid's OnLoad is called which rebinds the grid and calls AutoDataBind method, which kills my row selection. I definitely can set Selection on GridDataBound even, but that makes my code not so well structured. Is there any way to disable AutoDataBind method call?

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Esk
Top achievements
Rank 2
answered on 27 Jun 2008, 03:26 PM
try setting  AutoGenerateColumns="False"  inside the MasterTableView tag

for example <MasterTableView  AutoGenerateColumns="False">
0
Sebastian
Telerik team
answered on 30 Jun 2008, 07:40 AM
Hi guys,

You may also consider switching to NeedDataSource binding as shown in this online demo:

http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/NeedDataSource/DefaultCS.aspx

Thus operations like sorting/paging/editing/etc. will not require any additional coding as opposed to simple binding with DataBind() calls.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Mike
Top achievements
Rank 1
Answers by
Esk
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or