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

Ajaxify RadGrid not working

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dingen
Top achievements
Rank 1
dingen asked on 24 Nov 2009, 11:39 AM
Hi,

I am trying to "Ajaxify' my Radgrid. This page works without the RadAjaxPanel but not with?

<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
 
        <script type="text/javascript"
            //<![CDATA[
            function openWin() {
                var oWnd = radopen("ColumnsPopup.aspx", "RadWindow1");
            }
            function OnClientClose(oWnd, args) {
                __doPostBack('__Page', 'PostbackFromJs');
            }
            //]]> 
        </script> 
 
    </telerik:RadCodeBlock> 
</head> 
<body> 
    <form id="form1" runat="server"
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false" 
        ReloadOnShow="true" runat="server" Skin="Sunset"
        <Windows> 
            <telerik:RadWindow ID="RadWindow1" Behaviors="Close" OnClientClose="OnClientClose" 
                NavigateUrl="ColumnsPopup.aspx" runat="server"
            </telerik:RadWindow> 
        </Windows> 
    </telerik:RadWindowManager> 
  
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"
    </telerik:RadAjaxLoadingPanel> 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px"
        <input value="Open Popup" type ="button" onclick="openWin();" /> 
    <asp:Button ID="Button1" runat="server" Text="pdf" /> 
    <telerik:RadGrid ID="ResultsGrid" runat="server" EnableHeaderContextMenu="True" GridLines="None" 
        PageSize="3" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" 
        AllowMultiRowSelection="True"
        <ExportSettings ExportOnlyData=true IgnorePaging=false  Pdf-AllowAdd=true > 
            <Pdf PageHeight="11in" PageWidth="36in" /> 
             
        </ExportSettings> 
        <MasterTableView AutoGenerateColumns="true"
            <Columns> 
                <telerik:GridClientSelectColumn> 
                </telerik:GridClientSelectColumn> 
            </Columns> 
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px"></HeaderStyle> 
            </ExpandCollapseColumn> 
        </MasterTableView> 
        <ClientSettings AllowColumnsReorder="True"
            <Selecting AllowRowSelect="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
    </telerik:RadAjaxPanel> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" 
        SelectCommand="SELECT * FROM [Customers]"></asp:SqlDataSource> 
    <div> 
    </div> 
    </form> 
</body> 
</html> 
 

this is the code behind:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
        BindGrid() 
        ResultsGrid.DataBind() 
    End Sub 
 
    ''' <remarks></remarks
    Protected Sub BindGrid() 
        Dim sqlconnection As SqlConnection = New SqlConnection(SqlDataSource1.ConnectionString) 
        sqlconnection.Open() 
        Dim ds As DataSet = New DataSet() 
        Dim da As SqlDataAdapter = New SqlDataAdapter("select * from customers", sqlconnection) 
        da.Fill(ds) 
        ResultsGrid.DataSource = ds 
    End Sub 
 
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click 
        ResultsGrid.MasterTableView.ExportToPdf() 
    End Sub 


thanks

Dirk

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Nov 2009, 12:38 PM
Hello Dingen,

Generally speaking, the exporting feature of the control work with regular postbacks only. The reason is the grid prepares additional information when performing export operation (available on postback).

To bypass this limitation you can wire the OnRequestStart event of the ajax panel, determine whether the target control is ajaxified and explicitly disable its ajax mode to export with regular postback.

Please read more about grid exporting and ajax in this only help topic:
Export from ajaxified grid

Regards,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
dingen
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or