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

Telerik MVC grid Access Data out side the grid binding

0 Answers 37 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.
HaBo
Top achievements
Rank 1
HaBo asked on 24 Jan 2012, 05:46 PM
In Telerik MVC 3.0 Grid (Razor engine)

How can i access the data after grid binding.
I am using Detailed view tab
using below code.
items.Add().Text("Additional Tab")
.Content(@<text>
@(Html.Telerik().Grid<Models.PModel>()
.Name("Additional_<#= AddressID #>")
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("Action""Controller"new { ID = "<#= ID #>" }))
.Pageable()
.Sortable()
.Columns(columns =>
{
columns.Bound(e => e.Name).Title("Name").Width(150);
columns.Bound(e => e.Email).Title("Email");
columns.Bound(e => e.Status).Title("Prescriber Status");
columns.Template(e => e.ID).ClientTemplate(Ajax.ActionLink("Edit""EditDetails"new {ID = "<#= ID #>", PID = "<#= PID #>" }, new AjaxOptions
{
OnSuccess = "LoadAddEditForm",
UpdateTargetId = "ShowAddEditFormDialogModel",
InsertionMode = InsertionMode.Replace
}, new { @class "button" }).ToString());
})
.NoRecordsTemplate("No additional added for this")
)
@Ajax.ActionLink("Add New""AddEdit""Controller"new { ID =  "<#= ID #>"},
new AjaxOptions
{
OnSuccess = "LoadAddEditForm",
UpdateTargetId = "ShowAddEditFormDialogModel",
InsertionMode = InsertionMode.Replace
}, new { @class "button", id="AjaxAddNewButton" })
</text>);

Now the Problem is,, if you notice i have added a Ajax.Action link after the grid binding. 
@Ajax.ActionLink("Add New", "AddEdit", "Controller", new { ID =  "<#= ID #>"},
new AjaxOptions
{
OnSuccess = "LoadAddEditForm",
UpdateTargetId = "ShowAddEditFormDialogModel",
InsertionMode = InsertionMode.Replace
}, new { @class = "button", id="AjaxAddNewButton" })

In this Ajax Link I can get the value of object new { ID =  "<#= ID #>"} 
as I am trying to access the <#= ID #> after the grid binding, it is not rendering the value.
How can i get this work?

Any help would be greatly appreciated.

Thanks

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