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

[Solved] Custom command in toolbar can't pass viewdata

1 Answer 129 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.
MICHAEL
Top achievements
Rank 1
MICHAEL asked on 22 Jun 2012, 09:36 AM
Hello,

I have a custom command that when i pass in my viewdata, it is always null.  For the update or select methods, the view data is passed in.  I have the custom command in the toolbar.  I'm not sure why it is always passing null. Could it be using the toolbar? I'm using the latest verson of the controls.

My command in toolbar:

.ToolBar(commands =>

{

commands.Insert();

commands.Custom()

.HtmlAttributes(

 

new { id = "export" })

.Text(

 

"Export To Pdf")

.Action(

 

"ExportToPdf", "Student", new { page = 1, groupby = "~", orderBy = "~", filter = "~", searchId = ViewData["searchId"] });

})


Also, my controller:

 

public ActionResult ExportToPdf(int page, string groupBy, string orderBy, string filter, string searchId)

{

}

1 Answer, 1 is accepted

Sort by
0
MICHAEL
Top achievements
Rank 1
answered on 22 Jun 2012, 11:10 AM
it looks like if i limit the number of parameters to 4, the viewdata is passed in.  so i guess there is a limit of number of parameters you can pass in? also, how would i pass in the page count.  right now its hard coded 1, how can i pass in the number of pages the grid currently has?  thanks in advance!

commands.Custom()

.HtmlAttributes(

new { id = "export" })

.Text(

"Export To Pdf")

.Action(

"ExportToPdf", "Student", new { page = 1, groupby = "~", orderBy = "~", searchId = ViewData["searchId"] });

})


Tags
Grid
Asked by
MICHAEL
Top achievements
Rank 1
Answers by
MICHAEL
Top achievements
Rank 1
Share this question
or