I have a main page with a radgrid. Double clicking the grid opens up a radwindow that lets the users edit the grid row data. I want the grid on the parent page to refresh without having to do a full page refresh. I tried the Ajax call. Everything seem to work as expected. But the grid does not seem to refresh. I can debug the code and see that the server side code does fireup and the grid rebinds successfully. It just does not show up on screen. Here is my code.
On the main page, I have the AJAX manager as below.
telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
<telerik:AjaxUpdatedControl ControlID="grdAdminList" />
Here is the server side code:
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
if (e.Argument == "Rebind")
This function calls the actual refreshGrid function that is on the main page.
Main page function:
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
43 Answers, 1 is accepted
Thank you for the quick response. But I am not sure how the links you provided are related to what I am trying to accomplish. I do not have an ajaxpanel in my app. I only have ajaxmanager. The code behind is working as expected and the ajax request is being processed as well. When I debug the code, I can see it stepping through the ajax request and rebinding the grind which then has the updated data. It's the grid on the screen that does not show the updated data. To me it looks like the client side is missing something. Please look at my code that I posted earlier and confirm that at least I am going in the right direction.
Thanks a lot!
I am now trying to move the AjaxManager control to the master page and manage ajax calls on the content page using the AjaxManagerProxy control.
radMgr = $find("<%= RadAjaxManagerMaster.ClientID %>"); (did not work)
var radMgr = $find("<%= RadAjaxManagerProxy.ClientID %>"); (did not work)
And finally tried,
var radMgr = $find("<%= RadAjaxManagerMaster.GetCurrent(Page).ClientID %>"); (did not work)
All of the above did not work. In the first and the last case, it kept saying that the control did not exist in the context. The second option did not give me any error message, but did not work either.
Please let me know how I can get it to work.
I think that the following online demo:
and the demo project from the relevant KB article on our site:
can become the basis for your implementation. Additionally, how to reference the ajax manager in master/content page scenario and trigger ajax requests from the client you can learn from the resources pointed below:
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
When I use the below code, I get a null exception (System.NullReferenceException: Object reference not set to an instance of an object.). I am trying to ajaxify a radgrid in the content page using the proxy.
radMgr = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
Does using a bit different syntax, namely:
radMgr = $find("<%= RadAjaxManager.GetCurrent(this).ClientID %>");
radMgr = $find("<%= RadAjaxManager.GetCurrent(Me).ClientID %>");
makes a difference? This is indeed an odd issue you come upon and the best means to progress in our investigation is to put together a working subset of your project and send it attached to a formal support ticket. We will examine it in detail and will advice you further.
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
The best overloaded method match for 'Telerik.Web.UI.RadAjaxManager.GetCurrent(System.Web.UI.Page)' has some invalid arguments
I have a standard web page with the radscript manager and radajax manager.
I have a user control based on the rad grid editing demo. instead of the ajax manager I am using the manager proxy in my user control
this is the sample code i used to base my user control
Any help will be appreciated
Try modifying the line in your code that throws the exception as below:
instead of trying to get manager instance as you did:
Let me know if this helps.
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
and my complete code is below.
<!-- Footer Section -- In this footer user control i placed RadScriptManager which i used it in every page along
with some footer text-->
<tcn:footer ID="footer" runat="server" />
<telerik:RadWindowManager ShowContentDuringLoad="false" VisibleTitlebar="true" Modal="true" RestrictionZoneID="divMainBody" VisibleStatusbar="true" AutoSize="false" Skin="Black" ID="RadWindowManager1" Width="600px" Height="600px" runat="server">
This popup contains a RadGrid2 with checkbox column and a Add User Button.
In the button click event iam inserting the selected user record in the grid directly to the database.
after succesffully inserted into database. I added the following code.
Please note: Make sure the order of placing the RadManagers like The Script Manager followed by Ajax Manager as mentioned in the above code (Page1.aspx)
Hope it helps some one like me..
I did not know that I needed to authorize the events coming from the RadAjaxManager1to also update the grid. That did the trick for me and it seems logical.
EnableViewState="false" should not be an option here to solve the problem...
I don't want to set enableviewstate="false" unless I have to. Is there another way around this? I am providing my code below.
I appreciate any help on this that I can get!
I guess that you expect the grid to refresh after you add a comment with your popup form and close it?
this is probably obvious for you, but just in case, you have to close your popup like that:
This is the part that will call the refreshgrid...
and last maybe that you are using Page.ClientScript.RegisterStartupScript instead of ScriptManager.RegisterStartupScript or vice versa...
If you are already doing all this, please, post a 'working' sample so that somebody can check after you code...
Yes. I want the grid to refresh after I have added a new record. When I put a break at the databind (after the record is added), I can see the added data in the radgrid.mastertablebview items.
I typed: ? radgrid1.MasterTableView.Items(2).Cells(6).Text into the immediate window (in Visual Studio), and got this result: "87456".
"1/27/2011 12:00:00 AM"
The grid is just not refreshing on the screen. I don't know how else to explain it.
I do have a addrecord.aspx page that has all the code you mentioned. I did change from clientscript.registerstartupscript to scripmanager.registerstartupscript, but that didn't make a difference.
Here's the code I have for that page:
The ScriptManager.RegisterStartupScript thing did the trick for me. My problem was that the ajax event on the page was not triggered.
Can you confirm that your code goes trough the RadAjaxManager1_AjaxRequest after you close the page and that the rebind is called?
After that I would try to get your grid out of the table structure you have here just to make sure it does not interfere.
Also does the grid refresh after you click on a refresh command button you could add on the grid?
Does the grid refresh after you trigger a new postback on the grid page?
It looks like everything works fine just the grid does not seem to understand it should load the data it gets back.
Then last I would try to remove the ajaxmanager from the page to see if things are working when not ajaxified?
Can't you put a small project together and hand it over so I can try it on my side?
Thanks for all your great questions. It really pointed me into the right directions. I tried pulling the grid out of the table, but that didn't seem to work. Then I wondered, is it because it's on a masterpage? I created a new page without a master, and copied all my controls and code to the new page. Worked like a charm.
I guess I have to do the ajax manager/ajax proxy thing. I was hoping to avoid that because I only need the ajaxmanager for the page itself. No other content areas need the ajax manager.
I'll let you know what gets the code to work.
Thank you again for the guidance!
Ok, so I got it to work. It did have something to do with master/content pages. The problem is, I have two content areas that both use the telerik script manager. I had to put that out on the Master page to prevent errors. The AjaxManager was hiccuping because it couldn't find that script manager. I had to put the AjaxManager on the MasterPage, and put a ajaxmanagerproxy to the content page.
My new issue is that my stylesheet is dropping for some reason. I'll get that working. However, that is not as relevant to this part of the discussion. Here's the code to make the master/content ajaxmanager happy:
- just make sure your AjaxManager is loaded before the content, or else you will throw a null exception when the content script tries to find the Master's AjaxManager
CommentReport.aspx - Just the part that will help with the example:
AddComment.aspx (Window Page) Just the parts relevant to discussion
AddComment.vb (Just relevant parts)
Just to say, I also have a master page but do not use the proxy thing and it is working just fine.
I did paste you code directly extracted from my working project.
Good luck with your project GP,
Anyway, Thank you again for your help.
Have a great weekend!
Sometimes I got into trouble and I'm happy to find someone just listening to my problems...
So, no, the (rad)scriptmanager is in the main page.
Here is how my controls are laid out.
The master page:
The popup looks like yours... I emoved the js code. It's the same then yours...
Spot any difference?
in your main tag.
I switched to that, and it seems to work, but the grid sort of "blinks" for a second. It disappears and reappears. When I use the proxy, the grid updates without a blink, and then area behind it blinks as if it's reloading other bits.
Regardless, folks, you now have a bunch of ways to reach the same goal.
You'll have a better weekend now, hopefully :)
i have problem with radajaxmanager,i have 2 radgrids in my page,while i am clicking the first radgrid itemcommand event ,i need to bind second radgrid ,i am using radajaxmanager,because of this i am unable to bind data to the second radgrid.when i removed radajaxmanager i am able to bind,but i need that radajaxmanager to open radwindow.i did my binding to first radgrid with the example of "http://demos.telerik.com/aspnet-ajax/controls/examples/integration/grwindow/defauidandltcs.aspx?product=window".please give me some idea.
Also bear in mind that window editing is supported directly with popup edit form:
Thank u for reply,
Here is my asp code,when i clicked on the 1st grid event,2nd grid was binding successfully.but when i clicking on th
"Add New Activity"(anchore tag of 'command item template' on below code)was not showing pop up.
I would try commenting out these lines:
sry for late reply... its urgent requirement so i did it in normal asp controls.
Yes,i have tried to click on "Add New Event"it doesnt fire properly.even i checked click 'edit'.it doesnt work.but before binding the 1st grid to 2nd grid it worked good, not now
Here's my setup:
Content Page AssetSchedule:
DetailCashEquivalents.aspx (Popup Window from AssetSchedules)
it's possible to reactivate the demo link ,all link in the forum doesn't work
I have a page with four Radtabs on it and in one of the tab I have a RadGrid and a Gridbuttoncoloumn.
On click of gridbuttoncoloumn, i want it to redirect it to another tab on the same page..In the Radgrid1_itemcommand event, i am checking the command name of my button coloumn and redirecting it to other tab something like this
radmultipage1.selectedindex = 2;
but its not working as expected.
I decided to post the solution to my problem. I was given this project and it contained both the RadAjaxPanel and RadAjaxManager. In the documentation it notes that using these together can cause problems here:
"If the same control is placed in a RadAjaxPanel as well as included in RadAjaxManager settings as an AJAXified control (i.e., it is AJAXified by both the RadAjaxPanel and RadAjaxManager),the RadAjaxManager's setting will not work."
It seems to be common sense but just in case someone is still having this issue, double check this. In my case, I just had to move my client-side radgrid rebinding to server-side withing my OnAjaxRequest method. I don't know if this will help anyone but there you go.
sorry for resurecting an old post, but im having this problem, also.
in my case my rebinds are from code behind, i have a form to insert the values into the database, all works fine and at this point it rebinds the radgrid, the problems happens if i delete on line of radgrid it updates the radgrid but, when i user the form to insert values, it inserts on DB, but stops refreshing the radgrid, i have to press the refresh button to refresh the grid any ideas?
It is possible that there is a error that prevents the update of the grid and you could inspect the browser's console for such error. If you are using RadAjaxMananger to enable the AJAX you need to ensure that the insert button is set in the AJAX settings to update the grid. Finally, if you are manually calling the Rebind method of the Grid, you could try to set the DataSource of the grid to empty collection before calling the Rebind method.
Hope this helps.
the Telerik team
In terms os erros nothing detected on console.
Without a sample project replicating the issue it will be difficult to guess what might be causing the problem, but I would assume that it is related to the AJAX settings of the RadAjaxManager. With that in mind, please ensure that the button is included in the AJAX settings and that the button is set to update the RadGrid (or the windows that you are referring to).
You can also open a regular support ticket with a sample, runnable project demonstrating the problem, so we can debug it locally.
Telerik by Progress