DataView control: other interesting events

In these last posts, we’ve already met several of the events generated by the DataView control. I thought it would be a good idea to write a small post which documents many of the events we’ve seen in the past:

command: fired when a user clicks over an element which has been “marked” with the sys:command system attribute;

  • rendering: this event is generated when the DataView control is about to start instantiating its template to get the rendered HTML. Any function which handles this event receives two parameters: the first, references the DataView control which generated the event; the second is an instance of the Sys.Data.DataEventArgs type.;
  • rendered: marks the end of the HTML rendering process. Functions configured as handlers receive two parameters: the first, references the DataView which generated the event; the second, is an instance of the Sys.DataDataEventArgs type;
  • itemRendering: event that is generated before each item’s template instantiation. We can do several interesting things here, like changing the default template or influencing the data that is going to be used during the template instantiation;
  • itemRendered: event which signals the end of the instantiation of a template. We’ve seen how we can use this event to customize the generated HTML for an item.

The Sys.Data.DataEventArgs object used by the rendering and rendered events introduces some interesting properties:

  • data: references the items that will be used for instantiating the templates;
  • itemPlaceholder: used for identifying the place holder where the template’s generated HTML will be put;
  • itemTemplate: reference to the template used for instantiating all the elements.

During the rendering event, you can set all of these properties  and influence the HTML generated by the DataView control.

Besides these events, there are still others, but we’ll leave them for the next posts because they’re related with the integration of the DataView control with data contexts. Stay tuned for more on MS AJAX.

Advertisements

~ by Luis Abreu on October 27, 2009.

3 Responses to “DataView control: other interesting events”

  1. The Sys.Data.DataEventArgs object used by the rendering and rendered events introduces some interesting properties:

    data: references the items that will be used for instantiating the templates;
    itemPlaceholder: used for identifying the place holder where the template’s generated HTML will be put;
    itemTemplate: reference to the template used for instantiating all the elements.

    During the rendering event, you can set all of these properties and influence the HTML generated by the DataView control.

    Does that last statement only apply when you are using local data as opposed to using data returned by the fetchOperator ? In my case you would not use the data:property but rely on the fetchOperator.

  2. The Sys.Data.DataEventArgs object used by the rendering and rendered events introduces some interesting properties:

    data: references the items that will be used for instantiating the templates;
    itemPlaceholder: used for identifying the place holder where the template’s generated HTML will be put;
    itemTemplate: reference to the template used for instantiating all the elements.

    During the rendering event, you can set all of these properties and influence the HTML generated by the DataView control.

    Does that last statement only apply when you are using local data as opposed to using data returned by the fetchOperator ? In my case you would not use the data:property but rely on the fetchOperator.

  3. i”m still investigating the data context and derived classes. i”ll be returning to that topic in future posts 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: