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

Separate Button(other than insert/update/delete)

2 Answers 60 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.
shiva
Top achievements
Rank 1
shiva asked on 18 Mar 2011, 03:08 PM
Hello All,

Does any body know how to include a command button which will take me to other screen from Grid.

Regards,
Shiva

2 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 18 Mar 2011, 03:22 PM
This is how i did it on an Ajax Grid.  Server Grid wouldn't be much different.

This would be a column in the grid.
columns.Bound(p => p.EmployeeId).ClientTemplate("<button class='t-grid-action t-button t-state-default' id='btnEdit' style='Width: 80px' onclick='OnEditButtonClick(<#= EmployeeId#>)\'>Edit</button>").Width(100).Filterable(false).Sortable(false).Title("");

Then add a script.
<script type="text/javascript">
  
         function OnEditButtonClick(id) {
             var url = '<%= Url.Action("Edit", "Employees") %>';
             url += "/" + id;
             window.location = url;
         }
  
 </script>

Hope that helps.
0
frederic rybkowski
Top achievements
Rank 1
answered on 18 Mar 2011, 05:34 PM
columns.Bound(c => o.id)
    .ClientTemplate(
        Html.ActionLink(
            ViewRes.SharedStrings.Edit_btn,
            "Edit",
            "Employees",
            new { id = "<#=id#>" },
            new { @class = "t-button" }).ToString()
        )
    .Title("Action")
    .Sortable(false)
    .Filterable(false)
    .Encoded(false);
Tags
Grid
Asked by
shiva
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
frederic rybkowski
Top achievements
Rank 1
Share this question
or