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

[Solved] RadAjaxManagerProxy with Usercontrol

8 Answers 439 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
k f
Top achievements
Rank 1
k f asked on 02 Oct 2007, 01:56 AM
I'm trying to follow the documentation "RadAjax and WebuserControls" as I have a page called Default.aspx that contains a AjaxManager as well as a panel in which I dynamically load my user controls.

I have a user control named projects that has Grid1 and Grid2.  I've followed the instructions on how to make Grid2 related to Grid1 so when I click on a row in Grid one, it initiates a call to my Database to retrieve info to populate Grid2.

Finally got everything working however, I'd like the loading panel to display while it's sending the ajaxrequest out to the database to update Grid2.

here is relevant code in my Default.aspx page.

<telerik:RadAjaxManager ID="RadAjaxMgrMain" runat="server"

DefaultLoadingPanelID="RadAjaxLoadingPanel1">

<ajaxsettings>

<telerik:AjaxSetting AjaxControlID="lbutPrjs">

<updatedcontrols>

<telerik:AjaxUpdatedControl ControlID="defaultMainPnl"

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

</updatedcontrols>

</telerik:AjaxSetting>

<telerik:AjaxSetting AjaxControlID="lbutPrjsSearch">

<updatedcontrols>

<telerik:AjaxUpdatedControl ControlID="defaultMainPnl"

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

</updatedcontrols>

</telerik:AjaxSetting>

</ajaxsettings>

</telerik:RadAjaxManager>


Relevant code from Projects.ascx

<script type="text/javascript">

function RowSelected()

{

window["<%= rgridWorkItems.ClientID %>"].AjaxRequest("<%= rgridWorkItems.UniqueID %>", "");

}

</script>

<asp:ScriptManagerProxy ID="scriptMgrProxyPrjs" runat="server"></asp:ScriptManagerProxy>

<telerik:RadAjaxManagerProxy ID="rAjaxMgrProxyPrjs" runat="server">

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="rGridPrjs">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="rgridWorkItems" />

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManagerProxy>

<radG:RadGrid ID="rGridPrjs" runat="server" AllowPaging="True"

AutoGenerateColumns="false" EnableAJAX="true" GridLines="Both"

ShowHeader="true" OnColumnCreated="rGridPrjs_OnColumnCreated"

OnItemCreated="rGridPrjs_OnItemCreated"

OnNeedDataSource="rGridPrjs_NeedDataSource" skin="Office2007">

<clientsettings allowcolumnsreorder="True" reordercolumnsonclient="True" AllowExpandCollapse="true" >

<selecting allowrowselect="True"></selecting>

<ClientEvents OnRowSelected="RowSelected" />

</clientsettings>

<MasterTableView HierarchyDefaultExpanded="false" HierarchyLoadMode="Client" EnableNoRecordsTemplate="false"

DataKeyNames="projectId,parentProjectId" Width="100%"

>

<SelfHierarchySettings ParentKeyName="parentProjectId" KeyName="projectId" />

<Columns>

<radG:GridBoundColumn DataField="projectNumber" HeaderText="Project Number" ReadOnly="true" SortExpression="projectNumber" UniqueName="ProjectNumber"></radG:GridBoundColumn>

<radG:GridBoundColumn DataField="projectSummary" HeaderText="Project Summary" ReadOnly="true" SortExpression="projectSummary" UniqueName="ProjectSummary"></radG:GridBoundColumn>

</Columns>

</MasterTableView>

</radG:RadGrid>

<radG:RadGrid ID="rgridWorkItems" runat="server" AllowPaging="true" DataSourceID="odsWorkItems"

AutoGenerateColumns="false"

EnableAjax="true" GridLines="Both" ShowHeader="true" Skin="Office2007">

<clientsettings allowcolumnsreorder="True" reordercolumnsonclient="True" AllowExpandCollapse="true">

<selecting allowrowselect="True"></selecting>

</clientsettings>

<MasterTableView EnableNoRecordsTemplate="true" DataKeyNames="workItemId" Width="100%">

<Columns>

<radG:GridBoundColumn DataField="workItemNumber" HeaderText="WorkItem #" ReadOnly="true" SortExpression="workItemNumber" UniqueName="workItemNumber"></radG:GridBoundColumn>

<radG:GridBoundColumn DataField="name" HeaderText="Name" ReadOnly="true" SortExpression="name" UniqueName="name"></radG:GridBoundColumn>

<radG:GridBoundColumn DataField="description" HeaderText="Description" ReadOnly="true" SortExpression="description" UniqueName="description"></radG:GridBoundColumn>

</Columns>

</MasterTableView>

</radG:RadGrid>


I'm starting to think because I'm calling ajaxRequest in jscript per instructions, i may need to display a loading animation manually and hide it manually when the call comes back from the server?

Any ideas?

8 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 02 Oct 2007, 11:16 PM
Hello k f,

You cannot use the built-in ajax of RadGrid along with external ajax controls. Please pick one of these options and it would work as expected.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
k f
Top achievements
Rank 1
answered on 03 Oct 2007, 11:20 AM
Hello Steve,

Not sure I'm following what you are saying.  It sounds like you are saying to set the EnableAjax = false on the rad grids.  Unfortunately in doing so that breaks the page because after doing so the related grid doesn't update when you click on a row in the parent grid.

Nothing happens and if you look at the code below I posted per the Telerik example, the code that handles the update on RowSelected is making an ajax call:

 function RowSelected()
 {
    window["<%= rgridWorkItems.ClientID %>"].AjaxRequest("<% = rgridWorkItems.UniqueID %>", "");
 }

Is there an example or documentation that shows what you are trying to say?

Thanks.
0
Steve
Telerik team
answered on 04 Oct 2007, 11:31 AM
Hello k f,

What I meant is that you should either change your page to use <%= RadAjaxManager1.ClientID %>.AjaxRequest(arguments); instead or try setting the EnableAJAXLoadingTemplate property of the updated grid to true. Generally you cannot have AjaxManager affect ajax enabled (built-in ajax) RadGrid.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
k f
Top achievements
Rank 1
answered on 04 Oct 2007, 11:51 AM
Thank you Steve,

I set the enableLoadingTemplate on the related grid to true and now it shows a small loading animation that can get me by for now.  I'd like to understand though how to get your first scenario to work.

I did try using the manager line like you mentioned with no luck either.  Since this was on a User Control I assume i needed a proxy on the user control because the default.aspx has a manager and I've read you can only have one manager per window.

I tried something such as this.  Didn't get any errors but still didn't get related grid to populate.

Digging through documentation yesterday i tried something like this.

function RowSelected()
 {
      var sourceGrid = '<%= rGridPrjs.ClientID %>';
      var relatedGrid = '<%= rgridWorkItems.UniqueID %>';
  
      window["<%= rAjaxMgrProxyPrjs.ClientID %>"].AjaxRequest(sourceGrid + "\r\n" + relatedGrid);
 }

The ajax manager on the parent page in this case is called rAjaxMgrPrjs.

Is there a simple example of how to get this working in a related Grid scenario like I'm working on?

Thanks.
0
Vladimir Milev
Telerik team
answered on 10 Oct 2007, 02:29 PM
Hello k f,

What you have done works fine. What Steve meant is that in order to use the RadGrid control with RadAjaxManager you will need to disable the grid's built-in ajax. When RadAjaxManager is in charge of the AJAX requests then settings with the loading panel should work without any problems.

Regards,
Vladimir Milev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
k f
Top achievements
Rank 1
answered on 10 Oct 2007, 02:46 PM
Thanks Vlad,

I would ok and probably prefer having the rad manager controlling this but I've just not been able to get anything working functionality.  THe only example I can find to go off with this type of scenario has the EnableAjax = true the way I'm doing it.

If you have a scenario of a related grid in a user controls where the ajax manager is on a parent page, I'd love a link to it if.

If not I'll just go with what I have and revisit down the road if I need to.

Thanks.
0
Vladimir Milev
Telerik team
answered on 12 Oct 2007, 12:29 PM
Hi k f,

We have put up a sample application for you. Please take a look and let us know if it helps.

Best wishes,
Vladimir Milev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
k f
Top achievements
Rank 1
answered on 12 Oct 2007, 03:41 PM
Hello Vlad,

Thank you very much for the example but it's not exactly what I'm doing.  My default.aspx is just a container with a asp:panel that I load User Controls dynamically. 

So there will be no hard code references to the various user controls loaded in default.aspx such as what you have.

Also, both of my grids are on the Projex.ascx user control.  None on default.aspx like you have.

Per documentation, was under the impression I had to somehow use a proxy on the user control in this scenario.

Again, thank you for the effort but not exactly what I'm doing.  I'll see if I can take anything away from this I may be able to hack together and get something to work.  Ran into a scenario with trying to implement a Rad Window and now think I'm going to have to get this to working.

Thanks.

Tags
Ajax
Asked by
k f
Top achievements
Rank 1
Answers by
Steve
Telerik team
k f
Top achievements
Rank 1
Vladimir Milev
Telerik team
Share this question
or