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
145
Bind to XmlDataSource
posted

I'm just trying to do a quick proof of concept - want to bind a webgrid to an XmlDataSource with an XPath filter, or to a simple list of objects, then modify data in some of the rows as each row is data bound. Instead of the .NET event OnItemDataBound, I see the event InitializeRow, but I can't seem to get it to fire. Does anyone know of a sample that goes over this (easy) scenario? I've used the .NET GridView control in the past, but this is my first experiment with the UltraWebGrid control, and I can't seem to find samples to handle some of these types of scenarios.

Thanks,

Bryan 

 

Parents
No Data
Reply
  • 12631
    posted

    Bryan:

    This should be pretty easy to do as you state.  I created a couple of samples (attached) using the 2007 Volume 3 WebGrid that demonstrate the use of the event both binding to a SqlDataSource and also an XmlDataSource.  Note to try the SQL sample you will have to update the connection string in the web.config.  Its currently pointing to a Northwind database.

    There should not be any magic, just connect the data source control and wire the InitializeRow event.  If you create it via the property grid, you should see something like this get added to the WebGrid markup:

     OnInitializeRow="UltraWebGrid1_InitializeRow" 

    You can of course add that manually yourself or even wire the event up in code:

     this.UltraWebGrid1.InitializeRow+=new Infragistics.WebUI.UltraWebGrid.InitializeRowEventHandler(UltraWebGrid1_InitializeRow);

    Hope that helps. 

    Devin 

    BindingSample.zip
Children