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

[Solved] Problems with RadAjaxManager

3 Answers 320 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Benigno Benavides Siller
Top achievements
Rank 1
Benigno Benavides Siller asked on 09 Jan 2008, 11:03 PM
Hi!

I'm using in my  application: visual studio 2008 ,framework 3.5 and the new version of Prometheus.

I have a page with 2 buttons (Button1 and Button2), a RadChart (RadChart1) and a RadGrid (RadGrid1). All these controls are in a content page.


I just can see the Button1 in the load event. So, when I click on Button1 I get the values for the RadGrid1 and the RadChart1 and the Button2 appears in the page. And I use the next code in the content page:

<

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX ="true">

<AjaxSettings >

<telerik:AjaxSetting AjaxControlID="Button1" >

<UpdatedControls >

<telerik:AjaxUpdatedControl ControlID="RadChart1" LoadingPanelID="RadAjaxLoadingPanel1" />

<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"

Width="75px">

<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'

style="border: 0px;" />

</telerik:RadAjaxLoadingPanel>


 I use the property visible of all the controls in order to get this.



My problem is when I click on Button1 the RadChart1 and the  RadGrid1 work  but Button2 doesn't appear. And I tried to solved it using the next code:

<

telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX ="True">

<AjaxSettings >

<telerik:AjaxSetting AjaxControlID="Button1" >

<UpdatedControls >

<telerik:AjaxUpdatedControl ControlID="RadChart1" LoadingPanelID="RadAjaxLoadingPanel1" />

<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>


<telerik:AjaxUpdatedControl ControlID="Button2" LoadingPanelID="RadAjaxLoadingPanel1"/>

</

UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"

Width="75px">

<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'

style="border: 0px;" />

</telerik:RadAjaxLoadingPanel>


Using the last code I can see the Button2 but when I click on this button , it doesn't work.

And I have this code in code behind :

Protected

Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExport.Click

Me.RadGrid1.ExportSettings.IgnorePaging = True

Me.RadGrid1.MasterTableView.ExportToExcel()

End Sub


Any suggestion?


Thank you




3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 10 Jan 2008, 08:20 AM
Hello Benigno,

Can you elaborate on what do you mean by not visible? Is it initially not visible? If this is the case can you paste the .aspx markup for the buttons and where this button is made visible? Any additional information you could provide will be useful.

Kind regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Benigno Benavides Siller
Top achievements
Rank 1
answered on 10 Jan 2008, 04:19 PM
This is the code in asp:

<%

@ Page Language="VB" AutoEventWireup="false" CodeFile="Transacciones.aspx.vb" MasterPageFile="~/MasterPage.master" Inherits="Transacciones" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<table style="width: 100%" cellpadding="0" cellspacing="0">

<tr>

<td style="width:451px; height: 30px;" >

<asp:Label ID="Label1" runat="server" Text="Parmeters:"></asp:Label>

</td>

<td style="width:13%" align="left" rowspan="2" valign="bottom" >

<asp:Button ID="Button1" runat="server" Text="Show information" />

</td>

</tr>

<tr>

<td style="width:451px">

&nbsp;<asp:DropDownList ID="ddlParameters" runat="server">

<asp:ListItem Value="Lineas">Line</asp:ListItem>

<asp:ListItem Value="Barras" >Bar</asp:ListItem>

</asp:DropDownList>

</td>

</tr>

<tr>

<td style="width: 451px">

<br />

<br />

<asp:Label ID="lblMessage2" runat="server" Visible="False" Text="There is not information." ForeColor="Red"></asp:Label>

</td>

</tr>

<tr>

<td colspan="2" valign="middle" >

<telerik:RadChart ID="RadChart1" runat="server" >

</telerik:RadChart>

</td>

</tr>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX ="True">

<AjaxSettings >

<telerik:AjaxSetting AjaxControlID="Button1" >

<UpdatedControls >

<telerik:AjaxUpdatedControl ControlID="RadChart1" LoadingPanelID="RadAjaxLoadingPanel1" />

<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1"/>

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"

Width="75px">

<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'

style="border: 0px;" />

</telerik:RadAjaxLoadingPanel>

<tr>

<td>

<br />

<br />

</td>

</tr>

<tr>

<td colspan="2" valign="middle" >

<telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="true" OnNeedDataSource="RadGrid1_NeedDataSource">

</telerik:RadGrid>

</td>

</tr>

</

table>

<

br />

<

br />

<table style="width:100%">

<tr align="right" >

<td colspan="3" >

<asp:Button ID="Button2" runat="server" Text="Export to  excel.l" Visible="false" />

</td>

</tr>

<tr>

<td colspan="3" valign="middle">

<asp:Label ID="lblMoreInformation" runat="server" Text="More  information"></asp:Label></td>

</tr>

<tr>

<td align="left" style="height: 14px; width: 80%;" >

<asp:Label ID="lblMinDate" runat="server" Text="Label"></asp:Label>

</td>

<td rowspan="2" style="vertical-align:middle ; width: 10%;" >

<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>

</td>

<td rowspan="2" style="vertical-align:top ;width:10% " >

<asp:Image ID="imgShowStatus" runat="server" />

</td>

</tr>

<tr>

<td align="left" style="height: 8px; width: 80%;" >

<asp:Label ID="lblMaxDate" runat="server" Text="Label"></asp:Label>

</td>

</tr>

</table>

 

 

 

</

asp:Content>

An this is my code behind:

Protected

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

hideInformation()

End If

 

End Sub



Public

Sub hideInformation()

Me.RadChart1.Visible = False
Me.RadGrid1.Visible = False
Me.lblMoreInformation.Visible = False
Me.lblMinDate.Visible = False
Me.lblMaxDate.Visible = False
Me.lblMessage.Visible = False
Me.imgShowStatus.Visible = False
Me.Button2.Visible = False

 

End Sub



Protected Sub btnButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

hideInformation()

defineImage()

 

End Sub

Public Sub defineImage()

 

Dim graficaV As New graficaVO

Dim graficaD As New graficaDAO

Dim scriptString As String

 

graficaV = graficaD.getInformation()

 

If graficaV.getError = True Then

scriptString =

"<script language=javascript type=text/javascript>var message=ERROR. Problems with the page.';alert(message); window.location='Default.aspx';</script>"

Response.Write(scriptString)

 

ElseIf graficaV.getError = False Then

If graficaV.getIsEmpty = True Then

Me.lblMessage2.Visible = True

hideInformation()

Else

Me.lblMessage2.Visible = False

showInformation()

drawRadChart(graficaV)' This method defines our RadChart1

defineTable(graficaV)'This defines our RadGrid1
End If
End If
End Sub

Public Sub showInformation()

 

Me.RadChart1.Visible = True
Me.RadGrid1.Visible = True
Me.lblMoreInformation.Visible = True
Me.lblMinDate.Visible = True
Me.lblMaxDate.Visible = True
Me.lblMessage.Visible = True
Me.imgShowStatus.Visible = True
Me.Button2.Visible = True

 

End

Sub


Public Sub defineTable(ByVal graficaV As graficaVOP)

 

Dim graficaD As New graficaDAO

Dim scriptString As String

graficaV = graficaD.getInformation2(graficaV)

 

If graficaV.getError = True Then

scriptString =

"<script language=javascript type=text/javascript>var message='ERROR';alert(message); window.location='Default.aspx';</script>"

Response.Write(scriptString)

 

ElseIf graficaV.getError = False Then

If graficaV.getIsEmpty = True Then

Me.lblMessage2.Visible = True

Else

Me.RadGrid1.DataSource = graficaV.getDatos

Me.RadGrid1.DataBind()

 

End If

End If

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click

Me.RadGrid1.ExportSettings.IgnorePaging = True

Me.RadGrid1.MasterTableView.ExportToExcel()

End Sub

Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource

 

Dim graficaV As New graficaVO

Dim graficaD As New graficaDAO

Dim scriptString as string

graficaV = graficaD.getInformation2(graficaV)

 

If graficaV.getError = True Then

 

scriptString =

"<script language=javascript type=text/javascript>var message='ERROR';alert(message); window.location='Default.aspx';</script>"

 

Response.Write(scriptString)

ElseIf graficaV.getError = False Then

 

 

If graficaV.getIsEmpty = True Then

 

Else

 

Me.RadGrid1.DataSource = graficaV.getDatos.Tables("Transacciones2")

End If

 

End If

End

Sub




Thanks




0
Steve
Telerik team
answered on 11 Jan 2008, 12:00 PM
Hello Benigno,

We reviewed the pasted code here and our advise is to turn off ajax when exporting. You cannot export when ajax is enabled due to xmlhttp request specifics. A workaround is available in the following code library. Give it a spin and let us know how it goes.

Regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Ajax
Asked by
Benigno Benavides Siller
Top achievements
Rank 1
Answers by
Steve
Telerik team
Benigno Benavides Siller
Top achievements
Rank 1
Share this question
or