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

[Solved] Url.Action JScript error

1 Answer 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Radu
Top achievements
Rank 1
Radu asked on 27 Jun 2011, 03:49 AM
Hello,

Environment:
Telerik:    2011.3.315
MVC:    3
EF:     4.1

I have a Grid -> Tabstrip -> PartialView -> Grid set up with Ajax. The inner-most Grid has checkboxes, so I use this to post the selections:
PartialView:

<

 

 

button class="t-button" onclick="displayChecked(<% =ViewData["TaskId"] %>)">Assign Selected</button>

 


Page:

 

 

function displayChecked(taskId) {

 

 

 

var checkedRecords = $(':checked');

 

 

 

var taskId = taskId;

 

 

 

if (checkedRecords.length < 1) {

 

alert(

 

'Check a few grid rows first.');

 

 

 

return;

 

}

 

else {

 

alert(taskId);

$(

 

'#result').load('<%= Url.Action("DisplayChecked", "Tasks")%>', { checkedRecords: checkedRecords, taskId: taskId });

 

 

 

return;

 

}

}



Controller:

 

 

public ActionResult DisplayChecked(string[] checkedRecords, int taskId)

 

{

 

}

When I click the button, I get the alert message with the taskId as expected, followed by an "MS JScript runtime error: Object doesn't support this property or method" in asset.asdx at this line:
 

 

return

 

 

e.each(function(){var w=i(this);u=i.meta?i.extend({},u,w.data()):u;if(!w.data(v)){var x=t.init(this,u);w.data(v,x);n.trigger(this,"load");if(t.success){t.success(x)}}})

 


If I change my code as follows, I don't get the error but I can no longer pass the taskId parameter:

Page:
$('#result').load('<%= Url.Action("DisplayChecked", "Tasks")%>', checkedRecords );

Controller :

public ActionResult DisplayChecked(string[] checkedRecords)

 

{

 

}

How can I send the taskId parameter without getting the JScript error?

Many thanks,

Radu

1 Answer, 1 is accepted

Sort by
0
Gurarpan
Top achievements
Rank 1
answered on 06 Aug 2011, 04:16 AM
Please let me know if you get the solution for this issue.
Tags
Grid
Asked by
Radu
Top achievements
Rank 1
Answers by
Gurarpan
Top achievements
Rank 1
Share this question
or