binding a radgrid using javascript/ajax

3 posts, 0 answers
  1. diane
    diane avatar
    26 posts
    Member since:
    Oct 2010

    Posted 27 Oct 2011 Link to this post

    I am trying to bind a radgrid after a button click event using Javacript ...here the code below ... 


    aspx page: on page load this is empty

     

    <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" >

     

     

    <MasterTableView>

     

     

    <Columns>

     

     

     

    <

     

    telerik:GridTemplateColumn >

     

     

     

     

     

    <HeaderStyle CssClass="header" Width="5%" Height="7%" />

     

     

     

     

     

    <HeaderTemplate>

     

     

     

     

     

    <asp:CheckBox ID="cbSelectAll" runat="server" onClick="checkedAll(this);"></asp:CheckBox>

     

     

     

     

     

    </HeaderTemplate>

     

     

     

     

     

    <ItemTemplate>

     

     

     

     

     

     

    <asp:CheckBox ID="chkBox" AutoPostBack="false" runat="server" ></asp:CheckBox>

     

     

     

     

     

    </ItemTemplate>

     

     

     

     

     

    </telerik:GridTemplateColumn>

     

     

     

    <

     

    telerik:GridBoundColumn UniqueName="SalesNo" DataField="SalesNo" HeaderText=" Sales Number" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left" >

     

     

    <HeaderStyle CssClass="header" />

     

     

    </telerik:GridBoundColumn>

     

     

    </Columns>

     

     

    </MasterTableView>

     

     

    </telerik:RadGrid>

    javacript:

    //results is data returned from a web service call using ajax

     

    function

     

    PopulateSalesGrid(results) {

     

     

     

     

     

    var rgGrid  = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

     

    rgGrid.set_dataSource(results); // here i get error value cannot be null

    rgGrid.dataBind();

     

     

    }

    ** I would perfer not to have the grid populated on page load.

    I also tried binding the radgrid on page load (code behind) and hiding it before button clicking event .... and showing if after the click event. But the issue here is ... when you cllick on the 'checked All' checkbox it gets all the values from the previous (page load) databind and not the values from the PopulateSalesGrid function.

    Any ideas how to fix this?

    thanks!!

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Oct 2011 Link to this post

    Hello Diane,

    Make sure that you have specified the web service method appropriately. Check the following help documentation which explains more about this.
    Client-side Binding.

    Thanks,
    Shinu.
  3. Ingemar
    Ingemar avatar
    29 posts
    Member since:
    Apr 2012

    Posted 11 Oct 2017 Link to this post

    This question seems unreadable to me.
Back to Top