repeater databinding @ server side
-
Hi,
I have a repeater in my aspx page. The datasource for this will change for different types of call hence I cannot do<%#DataBinder.Eval(Container.DataItem, "Id")%>
...
as the dataItem will be different. Which is the best way to do it server side?
Thanks,
-
Hi,
I have a repeater in my aspx page. The datasource for this will change for different types of call hence I cannot do<%#DataBinder.Eval(Container.DataItem, "Id")%>
...
as the dataItem will be different. Which is the best way to do it server side?
Thanks,
If you want to use DataBinding like this you would need to convert each datasource to use the same columns, with the same names. Not a bad thing. If the datasources will all have different columns with different types you may want to use a DataGrid and set AutoGenerateColumns=true; Otherwise, you will need to manually add ITemplates to your repeater based on the selected datasource
I know the language. I've read a book. - _Madmatt
-
If you want to use DataBinding like this you would need to convert each datasource to use the same columns, with the same names. Not a bad thing. If the datasources will all have different columns with different types you may want to use a DataGrid and set AutoGenerateColumns=true; Otherwise, you will need to manually add ITemplates to your repeater based on the selected datasource
I know the language. I've read a book. - _Madmatt
yes I had set the autogenerate columns as true and it works fine. Issue is I also had a jquery to select the selected row value and it ended up having lots of magic numbers for the colums in different states. Very difficult to understand and maintain. I want to access dataItem value on row click and hence trying to map dynamically . Thanks,