Hi,
I have a template column in my RadGrid which uses the following ItemTemplate:
The status control simply has one public property that takes the value from the CurrentStatus datafield of the ObjectDataSource, and sets it's ImageControl ImageURL property to the appropriate status image.
This works on the first time the grid is loaded, and when the Edit event is fired.
But as soon as the page index is changed, none of the images load.
Any ideas?
Thanks,
Richard.
I have a template column in my RadGrid which uses the following ItemTemplate:
| <uc1:StatusIndicator ID="StatusIndicator1" runat="server" CurrentStatus='<%# DataBinder.Eval(Container, "DataItem.CurrentStatus") %>' /> |
The status control simply has one public property that takes the value from the CurrentStatus datafield of the ObjectDataSource, and sets it's ImageControl ImageURL property to the appropriate status image.
This works on the first time the grid is loaded, and when the Edit event is fired.
But as soon as the page index is changed, none of the images load.
Any ideas?
Thanks,
Richard.
5 Answers, 1 is accepted
0
Hi Richard,
Please, find attached a sample page which handles this functionality. Hope it helps.
Greetings,
Ves
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please, find attached a sample page which handles this functionality. Hope it helps.
Greetings,
Ves
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Richard
Top achievements
Rank 1
answered on 30 Apr 2008, 09:15 AM
Hi there,
Thanks for your reply - but I've been scratching my head over the sample project that you sent, and can't seem to 'spot the difference'. Can you tell me specifically what it is I actually need to do to stop the embedded user controls from 'disappearing' on a postback?
That way I'll know specifically what to look for in your sample project and can then do the same in mine.
Thanks
Richard.
Thanks for your reply - but I've been scratching my head over the sample project that you sent, and can't seem to 'spot the difference'. Can you tell me specifically what it is I actually need to do to stop the embedded user controls from 'disappearing' on a postback?
That way I'll know specifically what to look for in your sample project and can then do the same in mine.
Thanks
Richard.
0
Hi Richard,
Unfortunately we cannot say for certain what the difference with your code is unless we see it as well. Do you use NeedDataSource as in the sample we've sent you? Have you subscribed to the UserControl DataBinding event? Does the GridTemplateColumn matches yours?
Regards,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Unfortunately we cannot say for certain what the difference with your code is unless we see it as well. Do you use NeedDataSource as in the sample we've sent you? Have you subscribed to the UserControl DataBinding event? Does the GridTemplateColumn matches yours?
Regards,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Richard
Top achievements
Rank 1
answered on 30 Apr 2008, 03:29 PM
Hi Konstantin,
Unfortunately sending you a sample would be out of the question - our project is about 320mb.
I wasn't actually expecting you guys to wade through all my code!
Rather, if you could actually describe or provide documentation on how to use a custom user control in a GridTemplateColumn, so that it doesn't disappear on a postback for instance, then I and others experiencing the same problem would know what to do.
Perhaps the following information may help in this instance though:
1. No, I'm not using 'NeedDataSource'. The RadGrid has its DataSource property set to an ObjectDataSouce on Page_Load().
2. The GridTemplateColumn in your sample matches mine, except for the actual control of course!
3. I have not subscribed to my user control's DataBinding event. Could that be the problem?
Thanks for support it is much appreciated.
Kind regards
Richard.
Unfortunately sending you a sample would be out of the question - our project is about 320mb.
I wasn't actually expecting you guys to wade through all my code!
Rather, if you could actually describe or provide documentation on how to use a custom user control in a GridTemplateColumn, so that it doesn't disappear on a postback for instance, then I and others experiencing the same problem would know what to do.
Perhaps the following information may help in this instance though:
1. No, I'm not using 'NeedDataSource'. The RadGrid has its DataSource property set to an ObjectDataSouce on Page_Load().
2. The GridTemplateColumn in your sample matches mine, except for the actual control of course!
3. I have not subscribed to my user control's DataBinding event. Could that be the problem?
Thanks for support it is much appreciated.
Kind regards
Richard.
0
Hi Richard,
Thank you for getting back with the requested information.
I would recommend the Advanced data-binding technique for the Grid binding. It can save you a lot of troubles just because with the simple data-binding you need to rebind the Grid on specific actions like sorting, paging and many more. You should definitely check if the problem lies here so give the NeedDataSource a try.
Sincerely yours,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for getting back with the requested information.
I would recommend the Advanced data-binding technique for the Grid binding. It can save you a lot of troubles just because with the simple data-binding you need to rebind the Grid on specific actions like sorting, paging and many more. You should definitely check if the problem lies here so give the NeedDataSource a try.
Sincerely yours,
Konstantin Petkov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center