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

[Solved] Get Grid Data

0 Answers 46 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gurunath
Top achievements
Rank 1
Gurunath asked on 26 Oct 2011, 12:58 AM
Hi ,

I want to get the Expiration date value (Datepicker column)  from the grid using Jquery on a button click event.

@(Html.Telerik().Grid<

 

FormStaff>()

 

.Name(

 

"faFAAs")

 

.DataKeys(k =>

{

k.Add(m => m.StaffID);

})

.DataBinding(dataBinding =>

{

dataBinding.Ajax()

.Select(

 

"_Grid_SelectGroupMembers", "Request", new { Guid = @Model.Guid })

 

.Delete(

 

"Grid_DeleteGroupMembers", "Request", new { Guid = @Model.Guid });

 

})

.Columns(c =>

{

c.Bound(p => p.StaffID).Visible(

 

false);

 

c.Bound(p => p.LastName);

c.Bound(p => p.FirstName);

c.Bound(p => p.Department);

c.Bound(p => p.Login);

 

c.Bound(p => p.StaffID)

.Title(

 

"Expiration Date")

 

.ClientTemplate((Html.Telerik().DatePicker()

.Name(

 

"<#= StaffID#>" + "_DatePicker").ClientEvents(s => s.OnChange("OnSubmit_GroupMemGrid"))

 

.Min(

 

DateTime.Today)

 

.Max(

 

DateTime.Today.AddYears(10))

 

.ShowButton(

 

true)

 

.Value(

 

Convert.ToString("<#=ExpirationDate#>"))).ToHtmlString())

 

.Width(20);

 

c.Command(commands =>

{

commands.Delete().ButtonType(

 

GridButtonType.BareImage);

 

});

})

.ClientEvents(events =>

{

events.OnRowDataBound(

 

"OnLoad_AddGroupMemGrid");

 

 

})

 

.Pageable()

.Sortable()

.Filterable()

 

)


 

 

 

function OnLoad_AddGroupMemGrid(e) {

 

 

 

 

var dateId = "#"+ e.dataItem.StaffID + "_DatePicker";

 

$(dateId).val(e.dataItem.ExpirationDate);

}

I am tring to get the Expiration date using the below code but not successful.Appreciate if some one can help me on this.

 

var

 

 

grid = $('#faFAAs').data('tGrid');

for

 

 

(var i = 0; i < grid.$rows().length; i++) {

 

 

 

var row = grid.$rows()[i];

 

 

 

var dt = grid.$rows()[i].cells[5].val();

 

}

Tags
General Discussions
Asked by
Gurunath
Top achievements
Rank 1
Share this question
or