We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ItemTemplate lost after CallBack (filter, search, etc)

Hi,

I'm having a problem with using column ItemTemplates with CallBacks.

I have GridGroupingControl that is bound to a DataSet. I am adding an unbound column to it programatically with a custom ItemTemplate that displays a URL.

Everything works fine until I do something that triggers a CallBack (eg, selecting a column filter or using the search function) and then when the grid is redrawn my custom template is not applied.

What should I do to make sure that my custom template doesn't get lost?

I'm using SyncFusion 6.1.0.34 and .NET 2.0.


Thanks,

Mark


3 Replies

JA Janagan Syncfusion Team May 14, 2008 02:06 PM UTC

Hi Mark,

Thanks for your interest in Syncfusion products.

I am afraid that I am not able to reproduce the issue of unbound column with custom item templates . The item templates do not disappear after triggering callback through search function. Also created a sample to test this issue and please refer the sample in the link below:

http://websamples.syncfusion.com/samples/Grid.Web/6.2.0.40/Grid_ASP_unbound/main.htm


Please try running the sample and if still the issue exists, could you please try reproducing it in the above sample so that we can analyse further and sort out the cause to provide you a solution?

Thanks,
Janagan.





AD Administrator Syncfusion Team May 15, 2008 04:33 PM UTC

Hi Janagan,

Thanks very much for your repsonse. I looked at your example and I was able to see what I was doing wrong.

The trick is knowing when to set the ItemTemplate for the column...

I was doing it only once at initialization.

Whereas in your example, you set the ItemTemplate at initialization to just a blank Control, and then in the QueryCellStyleInfo event you set it to the correct template.

So the behavior seems to be that if you set the ItemTemplate at intialization, it gets forgotten after the table is first drawn. Instead, you need to apply it for every draw/redraw, and the way to do that is through the QueryCellStyleInfo event.

But I think your QueryCellStyleInfo handler is setting ItemTemplate too many times. It only needs to be set once on each redraw, not once for each row. Can you comment on that? I modified the QueryCellStyleInfo event handler to set the ItemTemplate only when the cell adrees is (0,1) (which only happens once on each draw) and it still works.

Thanks again,

Mark



RS Rajarajeswari S Syncfusion Team July 18, 2008 05:03 AM UTC


Hi Mark,

Thanks for the update.

We are happy to know that, your issue has been resolved. QueryCellStyleInfo event will get triggered for each and every grid cell get rendered. So we can modify the cells as we wish.

As you have mentioned, the ItemTemplateControls can also be intialized inside the event itself. Thanks for the infomation

Thanks,
Raji


Loader.
Live Chat Icon For mobile
Up arrow icon