This question is locked. New answers and comments are not allowed.

Hardy Wang
Top achievements
Rank 1
Hardy Wang
asked on 29 Mar 2011, 12:53 AM
Hi all,
According to sample at http://www.telerik.com/help/aspnet-mvc/m_telerik_web_mvc_ui_fluent_windowbuilder_loadcontentfrom_2.html I could pass parameter to the controller/action.
But is there a way I can pass parameter(s) from client side dynamically? For example when I call open I can pass some parameters.
BTW, I can see all server side API and class references from help, but where can I find client side API references?
Thanks
Hardy
According to sample at http://www.telerik.com/help/aspnet-mvc/m_telerik_web_mvc_ui_fluent_windowbuilder_loadcontentfrom_2.html I could pass parameter to the controller/action.
But is there a way I can pass parameter(s) from client side dynamically? For example when I call open I can pass some parameters.
$(
'#Window'
).data(
'tWindow'
).open();
BTW, I can see all server side API and class references from help, but where can I find client side API references?
Thanks
Hardy
16 Answers, 1 is accepted
0

nachid
Top achievements
Rank 1
answered on 29 Mar 2011, 07:18 AM
The code you showed does not more than opening the window
if you need to load a content from a controller/action, you need an ajaxrequest call
Search in this forum for the way to do it
if you need to load a content from a controller/action, you need an ajaxrequest call
Search in this forum for the way to do it
0

Hardy Wang
Top achievements
Rank 1
answered on 29 Mar 2011, 01:14 PM
Hi Nachid,
Yes, I could use Ajax call to get a partial view, but the question is how can I pass content to window from client side?
Hardy
Yes, I could use Ajax call to get a partial view, but the question is how can I pass content to window from client side?
Hardy
0

Mylène
Top achievements
Rank 1
answered on 21 Apr 2011, 05:17 PM
Hi Hardy,
Try this
var window = $('#Window').data('tWindow');
window.ajaxRequest("controllerName/actionName/");
window.center().open();
Try this
var window = $('#Window').data('tWindow');
window.ajaxRequest("controllerName/actionName/");
window.center().open();
0

CD
Top achievements
Rank 1
answered on 26 Aug 2011, 03:39 PM
Ok, that works to load content from the controller by returning a view, but what about passing a parameter to the controller via javascript in order to use it in the model thats returned in the view?
0
Hi Cd,
We just improved the ajaxRequest() method to accept a second parameter, the data that you want to pass to the server, i.e.:
windowObject.ajaxRequest("/Customers/Info", { customerId: 42 });
The patched telerik.window.js is attached.
Greetings,
Alex Gyoshev
the Telerik team
We just improved the ajaxRequest() method to accept a second parameter, the data that you want to pass to the server, i.e.:
windowObject.ajaxRequest("/Customers/Info", { customerId: 42 });
The patched telerik.window.js is attached.
Greetings,
Alex Gyoshev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0

CD
Top achievements
Rank 1
answered on 06 Sep 2011, 08:27 PM
Nice, that's very nice... will you be doing the same update for the Splitter control?
0
Done.
splitterObject.ajaxRequest(".t-pane:first", "/Customers/Info", { customerId: 42 });
All the best,
Alex Gyoshev
the Telerik team
splitterObject.ajaxRequest(".t-pane:first", "/Customers/Info", { customerId: 42 });
All the best,
Alex Gyoshev
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
0

mo2011ti
Top achievements
Rank 1
answered on 13 Sep 2011, 05:17 PM
Hi,
windowObject.ajaxRequest(...)not work for me.
i replaced the telerik.window.min.js file in my Scripts\2011.2.712 to the new one posted here.
the error i get is:
Microsoft JScript runtime error: Object doesn't support property or method 'ajaxRequest'
i just delete all my temporary file etc' to let my webb app to load the new js file.. still not working, any help?
Thanks
Moti
windowObject.ajaxRequest(...)not work for me.
i replaced the telerik.window.min.js file in my Scripts\2011.2.712 to the new one posted here.
the error i get is:
Microsoft JScript runtime error: Object doesn't support property or method 'ajaxRequest'
i just delete all my temporary file etc' to let my webb app to load the new js file.. still not working, any help?
Thanks
Moti
0
Hi Moti,
Regards,
Alex Gyoshev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Is windowObject defined and pointing to the client-side object of the window? Like so:
$("#WindowName").data("tWindow").ajaxRequest(...);
Regards,
Alex Gyoshev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0

mo2011ti
Top achievements
Rank 1
answered on 14 Sep 2011, 01:22 PM
Hi Alex,
thanks for sending this, i made a mistake and call $("#WindowName").ajaxRequest(...);
i fix it to :
$("#WindowName").data("tWindow").ajaxRequest(...);
and work very nice.
Thank you for yor reply.
Moti
thanks for sending this, i made a mistake and call $("#WindowName").ajaxRequest(...);
i fix it to :
$("#WindowName").data("tWindow").ajaxRequest(...);
and work very nice.
Thank you for yor reply.
Moti
0

Nate
Top achievements
Rank 1
answered on 16 Sep 2011, 07:10 PM
Hey, so is the second parameter a JSON object? How do I evaluate the object on the controller side? Can you give me a sample of the action method that handles it?
Thanks,
Thanks,
0
Hello Nate,
The second parameter is the URL to the Action. The third one is the data, which you want to send to the server and it should be JSON:
[JavaScript]:
And the send customerId is evaluated in this way on the server:
Georgi Krustev
the Telerik team
The second parameter is the URL to the Action. The third one is the data, which you want to send to the server and it should be JSON:
[JavaScript]:
splitterObject.ajaxRequest(
".t-pane:first"
,
"/Customers/Info"
, { customerId: 42 });
And the send customerId is evaluated in this way on the server:
[HttpPost]
public
ActionResult Info(
int
customerId) {
//customerId is 42
}
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0

cp
Top achievements
Rank 1
answered on 14 Oct 2011, 11:53 PM
I'm thinking you need to POST instead of GET as well as add the content type in the js file.
Thanks,
Thanks,
0

Sreenivas
Top achievements
Rank 1
answered on 16 Nov 2011, 10:44 PM
I am seeing additional unknown parameter in the HTTP request. I am using version 2011.2.914
Controller action:
javascript code:
Firebug shows the following request:
"NetworkError:
500 Internal Server Error -
http://localhost:58694/UserAdministration/ChangePasswordView?userName=natelunde&_=1321479858286"
What is the "&_=1321479501969" at the end? How do I suppress it?
Thanks in advance.
Controller action:
[HttpGet]
public ActionResult ChangePasswordView(string userName)
{
MembershipUser user = _userService.Get(userName);
return View(PartialView("ChangePassword", user));
}
function password_onClick(e) {
var username = e.id.split("_")[1];
if (username != undefined || username != null) {
var window = $('#ChangePasswordWindow').data('tWindow');
window.ajaxRequest("ChangePasswordView", { userName: username });
window.center().open();
}
}
Firebug shows the following request:
What is the "&_=1321479501969" at the end? How do I suppress it?
Thanks in advance.
0

MiBu
Top achievements
Rank 1
answered on 03 May 2012, 03:53 PM
What is the "&_=1321479501969" at the end? How do I suppress it?
I have the same problem. So far I couldn't find a workaround to send data to controller action. Is there any way?
Thanks,
mbudimir
I have the same problem. So far I couldn't find a workaround to send data to controller action. Is there any way?
Thanks,
mbudimir
0

Jeremy Wiebe
Top achievements
Rank 1
answered on 18 May 2012, 02:51 AM
That extra query parameter on the end is to prevent your browser from caching future requests to the same resource. Try changing your build to "Release" mode and seeing if the parameter still gets tacked on. I'm pretty sure it'll go away. It's there so that during development you don't have problems with the browser caching things and causing problems.