This is a migrated thread and some comments may be shown as answers.

Grid not updating after datasource update

3 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
bill
Top achievements
Rank 1
bill asked on 10 Sep 2008, 07:35 PM
When selected index changes, I populate several fields out side the grid.  The user can then make changes to a couple of the fields.  Also outside the grid is a save button, that sends changes to the database.  Inside the save button's click event I call the grid's rebind method.  This in turn calls the grid's NeedDataSource event handler.  I set a break in this method, I can see the updated data in the datatable.  I set the grid's datasource property equal to the datatable.  I expect the data in the grid to be updated, but nothing happens.

3 Answers, 1 is accepted

Sort by
0
bill
Top achievements
Rank 1
answered on 10 Sep 2008, 08:05 PM
This looks to be an issue when the panel the button is located in, is specified in the RadAjaxManager's Updated controls.  I put together a simple example:
        <asp:ScriptManager ID="ScriptManager1" runat="server">  
        </asp:ScriptManager> 
    <div> 
        <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None">  
            <MasterTableView> 
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px" /> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px" /> 
                </ExpandCollapseColumn> 
            </MasterTableView> 
            <FilterMenu EnableTheming="True">  
                <CollapseAnimation Duration="200" Type="OutQuint" /> 
            </FilterMenu> 
        </telerik:RadGrid> 
        </div> 
        <asp:Panel ID="Panel1" runat="server">  
        <asp:Button ID="Button1" runat="server" Text="Update" /></asp:Panel> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
                 <telerik:AjaxUpdatedControl ControlID="Panel1" /> 
                </UpdatedControls> 
             </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
    Protected Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles Button1.Click  
        RadGrid1.Rebind()  
    End Sub 
 
    Private Sub RadGrid1_NeedDataSource(ByVal source As ObjectByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource  
        Dim myTable As New DataTable  
        myTable.Columns.Add("Time")  
        myTable.Rows.Add(New String() {Date.Now.ToString("hh:mm:ss")})  
        RadGrid1.DataSource = myTable  
    End Sub 
0
Accepted
Vlad
Telerik team
answered on 11 Sep 2008, 05:49 AM
Hello bill,

Please change this setting to:
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="Panel1"> 
                  <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" />
                  </UpdatedControls>
             </telerik:AjaxSetting>
            </AjaxSettings>

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
bill
Top achievements
Rank 1
answered on 11 Sep 2008, 02:40 PM
I modified the code you posted some what to get the functionality I need.  Thanks for your post!

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="RadGrid1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="Panel1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
                        <telerik:AjaxSetting AjaxControlID="Panel1">  
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
 
Tags
Grid
Asked by
bill
Top achievements
Rank 1
Answers by
bill
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or