AjaxDataControls (ADC) FAQ - How to use an js array to bind a GridView?

A similar question was asked today in the ADC forums. Remember that the ADC controls can bind pure Javascript arrays without any problems. Here is a quick example:

<AjaxData:Gridview ID="ImagesList" runat="server" Visible=True>
    <Columns>
        <AjaxData:GridViewBoundColumn DataField="Id" HeaderText="Id"></AjaxData:GridViewBoundColumn>
        <AjaxData:GridViewBoundColumn DataField="Name" HeaderText="Name"></AjaxData:GridViewBoundColumn>
    </Columns>
</AjaxData:Gridview>


function pageLoad(sender, e)
{
    var data = new Array();
    data[0] = { Id: 1, Name: "Sonu Kapoor" };
    data[1] = { Id: 2, Name: "Xun Ding" };
    data[2] = { Id: 3, Name: "Gabriel" };
    data[3] = { Id: 3, Name: "Onur" };
    adc.set_dataSource(data);
    adc.dataBind();
}

See other FAQ examples.

Published Tuesday, November 18, 2008 12:00 PM by sonu
Filed under: , ,

Comments

# AjaxDataControls (ADC) FAQ - INDEX - Sonu on .NET

Tuesday, January 13, 2009 8:08 AM by AjaxDataControls (ADC) FAQ - INDEX - Sonu on .NET

Pingback from  AjaxDataControls (ADC) FAQ - INDEX - Sonu on .NET