Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2745
Binding the grid to a datasource in the code behind
posted

Hello!

I would like to bind my grid to a datasource in the code behind and generate my own columns and behaviors. Unfortunately I cannot get it all to work.

I would like to:

1. generate columns

2. add group by

3. add sorting behaviors

Can someone please tell me where in the code behind that this functionality should be included? I have tried a couple of different spots without success.

The generate columns code works alright and this is done on Page_Load. The Group by code is added in the same sub routine just before the DataBind call. I have tried to add the Sort behaviors in a lot of different positions but that seems to be tricky.

If i add the sort behavior in the code behind, the sortedcolumns is always null when I try to add a columnkey to it. If the sorting behavior is added in the html code, it is possible to add columns to it in the code behind but when the column is added, the sorting isn't really activated. It looks like it is activated (by the icon next to the column header in the grid) but it isn't. When clicked, it works of course...

All ideas are welcome ;-)

Thanks!

/Henrik

Parents Reply Children
No Data