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

Grid not show data with ajax enabled

2 Answers 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 29 Sep 2012, 12:24 AM
I have a grid that is bound to a list onclick of a button.  I have hooked up both the grid and the button in the RadAjaxManager. I have verified that everything is binds correctly, I can see that I have data in the columns while debugging but the grid is not updated with the data.

When I take the controls out of the ajaxmanager and allow the page to postback everything works fine, I get data in the grid.

Here's the relevant code:

ajaxmanager
<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" ClientEvents-OnRequestStart="mngRequestStarted">
<telerik:AjaxSetting AjaxControlID="RadGridGeoData">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridGeoData" UpdatePanelRenderMode="Inline" />
                    <telerik:AjaxUpdatedControl ControlID="btnGeoDetails" />
</UpdatedControls>
</telerik:AjaxSetting>
<ClientEvents OnRequestStart="mngRequestStarted" />
</telerik:RadAjaxManager>

GRID
<telerik:RadGrid ID="RadGridGeoData" runat="server" AllowSorting="True" AllowPaging="True"  
            Skin="Windows7" AllowFilteringByColumn="True" 
            AutoGenerateColumns="false" CellSpacing="0" GridLines="None"
            ShowGroupPanel="True">
            <ClientSettings AllowDragToGroup="false">
<ClientEvents OnCommand="GeoGridCommand" OnColumnClick="ColumnClick" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
<Resizing AllowColumnResize="True" />
</ClientSettings>
<AlternatingItemStyle Font-Size="10px" />
<MasterTableView 
CommandItemDisplay="TopAndBottom" HierarchyLoadMode="Client" AllowSorting="true" 
                NoMasterRecordsText="Loading data...." AllowFilteringByColumn="False">
<CommandItemSettings ExportToPdfText="Export to PDF" 
ShowAddNewRecordButton="False" ShowExportToCsvButton="True" ShowRefreshButton="False"></CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>


                <Columns>
                    <telerik:GridBoundColumn DataField="FacilityLink" FilterControlAltText="Filter FacilityName column"
HeaderText="Facility Name" SortExpression="FacilityName" UniqueName="FacilityLink" 
                        AllowSorting="False" Groupable="False" Reorderable="False">
<HeaderStyle Width="5%" HorizontalAlign="Center" />
</telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="FinanceNumber" FilterControlAltText="Filter FinanceNumber column"
HeaderText="Finance Number" SortExpression="FinanceNumber" UniqueName="FinanceNumber" 
                        AllowFiltering="False" AllowSorting="False" Groupable="False" 
                        Reorderable="False">
<HeaderStyle Width="5%" HorizontalAlign="Center" />
</telerik:GridBoundColumn>
...
...
...
</telerik:RadGrid>

Server side:
Protected Sub OnClick_btnGeoDetails(sender As Object, e As System.EventArgs)
        Dim ds As New FacilityServices
        Dim o = hiddenGeoDetailsGridDTO.Value
        Dim geodata As GeoData = JsonConvert.DeserializeObject(Of GeoData)(o)

        Dim dl = geodata.financeNumber
        Dim ol = geodata.originsList
        Dim rw = geodata.residualWithheld

        Dim geoDataList As List(Of FacilitiesList) = ds.GetFacilitiesStudy1Grid(ol, dl, rw)

        RadGridGeoData.DataSource = geoDataList
        RadGridGeoData.Rebind()
    End Sub

How do I get this to work with ajax enabled?

Thanks, Justin

2 Answers, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 29 Sep 2012, 06:44 AM
Hello,

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" ClientEvents-OnRequestStart="mngRequestStarted">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="btnGeoDetails">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridGeoData" UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="RadGridGeoData">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGridGeoData" UpdatePanelRenderMode="Inline" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

If you also want to update your your button (Text) then use below code else try with above code.

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" ClientEvents-OnRequestStart="mngRequestStarted">
           <AjaxSettings>
               <telerik:AjaxSetting AjaxControlID="btnGeoDetails">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGridGeoData" UpdatePanelRenderMode="Inline" />
                       <telerik:AjaxUpdatedControl ControlID="btnGeoDetails" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
 
               <telerik:AjaxSetting AjaxControlID="RadGridGeoData">
                   <UpdatedControls>
                       <telerik:AjaxUpdatedControl ControlID="RadGridGeoData" UpdatePanelRenderMode="Inline" />
                   </UpdatedControls>
               </telerik:AjaxSetting>
           </AjaxSettings>
       </telerik:RadAjaxManager>


Thanks,
Jayesh Goyani
0
Justin
Top achievements
Rank 1
answered on 01 Oct 2012, 08:47 PM
That Worked (I don't know why but it did)

Thanks!
Tags
Grid
Asked by
Justin
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Justin
Top achievements
Rank 1
Share this question
or