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

[Solved] Issue with RadAjaxManager

5 Answers 506 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Sharon
Top achievements
Rank 1
Sharon asked on 15 Oct 2007, 08:20 PM
I am hoping to overcome the infamous "Browser Back" issue.  When the user clicks on an item in a Radgrid and travels to a different page, I need to have that same grid and data available if the user navigates "Browser Back" to the page.  To do this, I am trying to use "Prometheus" Ajax.  I added the following to my page:

         <asp:ScriptManager runat="server" id="ScriptManager1">
         </asp:ScriptManager>
        
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"  DefaultLoadingPanelID="loadingPanel" EnableHistory="True"> 
             <AjaxSettings> 
                 <telerik:AjaxSetting AjaxControlID="rgSearchResults"> 
                     <UpdatedControls> 
                         <telerik:AjaxUpdatedControl ControlID="rgSearchResults" LoadingPanelID="loadingPanel" /> 
                     </UpdatedControls> 
                 </telerik:AjaxSetting>  
              </AjaxSettings> 
         </telerik:RadAjaxManager> 

     <telerik:RadAjaxLoadingPanel ID="loadingPanel" runat="server" Width="75px" Height="75px" Transparency="20"> 
         <asp:Image ID="Image2" runat="server" AlternateText="Loading..." ImageUrl="RadControls/Ajax/Skins/Default/Loading.gif" /> 
     </telerik:RadAjaxLoadingPanel> 

where rgSearchResults is the radgrid that I am very interesting in preserving in the Browser Back situation.  I also turned off the ajax on rgSearchResults.  I don't experience any compilation errors, but I get a postback when I click within the grid on a linkbutton.  I then tried it on a simple linkbutton outside of the grid, but experienced the same result. 

I am not sure if it is related, but in my Source view, the editor underlines "ScriptManager" as an error (unrecognized), but does not produce an error.  It compiles.  If I look in my toolbox, there is in fact a ScriptManager, so I am not sure why it is underlining as an error.

I am not sure if this is related or not, but once I added the ScriptManager and AjaxManager, I received a js error on the page that reads: 'Sys' is undefined.  If I remove the ScriptManager and AjaxManager, the js error goes away.

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 16 Oct 2007, 08:13 AM
Hello Sharon,

Are you using this code in AjaxEnabledWebSite (see attached screenshot)? This is required in order to have the appropriate http modules and handlers added to your web.config file. First make sure that you have MS AJAX installed on your machine, and if this is the case create AjaxEnabledWebSite which would host the code you pasted here.

Regards,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sharon
Top achievements
Rank 1
answered on 18 Oct 2007, 06:08 PM
Thank you.  Yes, you are right.  Now it is no longer doing a post back.

The reason why I am trying to use Prometheus is the following:
We have a selectable radgrid.  When the user clicks on a record, it takes them to another page.  They frequently hit Browser Back to navigate back to the radgrid.  I added RadAjaxManager, set the ajax to false on the radgrid.  I also set EnablePageHeadUpdate, EnableHistory to true on teh RadAjaxManager. 

When I try it out, I have the same issue that I had with the previous version of RadAjaxManager.  That is, if the user sorts the grid prior to selecting a row, upon return to the page, the grid appears unsorted.  However if the user clicks on a row, they are selecting the value in the "sorted" grid.  In other words, things get messed up.  The row value and the way the grid appears after a browser back aren't synced up.  I was hoping that Prometheus could solve this.

So my questions are:
1.)  Can the newest RadAjaxManager accomplish this?
2.)  If so, does the current configuration sound correct?

Thank you.
0
Sebastian
Telerik team
answered on 19 Oct 2007, 08:29 AM
Hello Sharon,

RadAjax "Prometheus" supports browser history as you can see from this documentation article:

http://www.telerik.com/help/radcontrols/prometheus/?ajxBackForwardbtns.html

Therefore, if you navigate back to the grid page using the back browser button (utilizing the new RadAjaxManager) the history should recover the previous setting on the page (including the grid sorted state). To test that with standard postbacks, visit this online demo of the product, sort grid column, click a link in the hyperlink column and then navigate back to the demo page using the back browser button:

http://www.telerik.com/demos/aspnet/Grid/Examples/GeneralFeatures/ColumnTypes/DefaultCS.aspx

Test the same configuration with RadAjaxManager "Prometheus" to see the effect. If the problem persists, please assemble a small working version of the test project and send it enclosed to a formal support ticket. We will review your complete code logic and will get back to you with our findings.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sharon
Top achievements
Rank 1
answered on 19 Oct 2007, 05:57 PM
Sorry, how can I add a project?  I have not done that before.
Below is the relevant code.
Added the RadAjaxManager to the example that you linked me to. 

When I sort the grid, click on a hyperlink and then go Back, the grid is still appearing unsorted.

<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="loadingPanel"

EnablePageHeadUpdate="true" EnableAjax="true" EnableHistory="true" EnableViewState="true" >

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="RadGrid1">

<UpdatedControls>

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

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<radG:RadGrid ID="RadGrid1" DataSourceID="AccessDataSource1" AllowPaging="True" ShowFooter="True"

runat="server" AutoGenerateColumns="False" AllowSorting="True" PageSize="3" Width="925px"

GridLines="None" CellPadding="0" Skin="Telerik" AllowMultiRowSelection="true">

<PagerStyle BackColor="#dbdbdb" ForeColor="Black"/>

<FooterStyle CssClass="footer" />

<MasterTableView ShowFooter="True">

<RowIndicatorColumn Visible="False" UniqueName="RowIndicator">

<HeaderStyle Width="20px"></HeaderStyle>

</RowIndicatorColumn>

<Columns>

<radG:GridEditCommandColumn FooterText="EditCommand footer" UniqueName="EditCommandColumn"

HeaderText="Edit&#160;Command Column">

</radG:GridEditCommandColumn>

<radG:GridClientSelectColumn UniqueName="CheckboxSelectColumn" HeaderText="CheckboxSelect column <br />" />

<radG:GridBoundColumn FooterText="BoundColumn footer" UniqueName="ContactTitle" SortExpression="ContactTitle"

HeaderText="Bound<br/>Column" DataField="ContactTitle">

</radG:GridBoundColumn>

 

<radG:GridDropDownColumn FooterText="DropDownColumn footer" UniqueName="DropDownListColumn"

ListTextField="ContactName" ListValueField="ContactName" DataSourceID="AccessDataSource2"

HeaderText="DropDown<br/>Column" DataField="ContactName">

</radG:GridDropDownColumn>

<radG:GridButtonColumn FooterText="LinkButtonColumn footer" DataTextFormatString="Remove selection"

UniqueName="column1" HeaderText="LinkButton<br/>Column" CommandName="Deselect"

DataTextField="CustomerID">

</radG:GridButtonColumn>

<radG:GridButtonColumn FooterText="ImageButtonColumn<br/>footer" DataTextFormatString="Select {0}"

ButtonType="ImageButton" UniqueName="column" HeaderText="ImageButton<br/>Column"

CommandName="Select" DataTextField="CustomerID" ImageUrl="Img/image.gif">

</radG:GridButtonColumn>

<radG:GridHyperLinkColumn FooterText="HyperLinkColumn footer" DataTextFormatString="Search Google for '{0}'"

DataNavigateUrlField="CompanyName" UniqueName="CompanyName" DataNavigateUrlFormatString="http://www.google.com/search?hl=en&amp;q={0}&amp;btnG=Google+Search"

HeaderText="HyperLink<br/>Column" DataTextField="CompanyName">

</radG:GridHyperLinkColumn>

<radG:GridTemplateColumn UniqueName="TemplateColumn" SortExpression="CompanyName">

<FooterTemplate>Template footer</FooterTemplate>

<FooterStyle VerticalAlign="Middle" HorizontalAlign="Center" />

<HeaderTemplate>

<table id="Table1" cellspacing="0" cellpadding="0" border="0" style="width:240px;">

<tr>

<td colspan="2" align="center" style="background: #dbdbdb;padding: 4px 0px;">

<b>Contact details</b></td>

</tr>

<tr>

<td style="width: 50%" align="center">

<asp:LinkButton CssClass="Button" ID="btnContName" Text="Contact name"

Tooltip="Sort by ContactName" CommandName='Sort' CommandArgument='ContactName' runat="server" /></td>

<td style="width: 50%" align="center">

<asp:LinkButton CssClass="Button" ID="btnContTitle" Text="Contact title"

Tooltip="Sort by ContactTitle" CommandName='Sort' CommandArgument='ContactTitle'

runat="server" /></td>

</tr>

</table>

</HeaderTemplate>

<ItemTemplate>

<table cellpadding="1" cellspacing="1" width="100%">

<tr>

<td style="width: 50%">

<%# Eval("ContactName") %>

</td>

<td style="width: 50%">

<%# Eval("ContactTitle") %>

</td>

</tr>

</table>

</ItemTemplate>

<ItemStyle HorizontalAlign="Center" />

</radG:GridTemplateColumn>

</Columns>

</MasterTableView>

<ClientSettings>

<Selecting AllowRowSelect="true" />

</ClientSettings>

</radG:RadGrid>

<asp:AccessDataSource ID="AccessDataSource1" DataFile="~/App_Data/Nwind.mdb"

SelectCommand="SELECT * FROM Customers" runat="server"></asp:AccessDataSource>

<asp:AccessDataSource ID="AccessDataSource2" DataFile="~/App_Data/Nwind.mdb"

SelectCommand="SELECT CustomerID, ContactName FROM Customers" runat="server"></asp:AccessDataSource>

</div>

</form>


0
Sharon
Top achievements
Rank 1
answered on 19 Oct 2007, 06:06 PM
Sorry about that.  Created a support ticket as instructed.
Thank you.
Tags
Ajax
Asked by
Sharon
Top achievements
Rank 1
Answers by
Steve
Telerik team
Sharon
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or