Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1730
getting row data based on selected link
posted

Hi,

I am using Asp.Net MVC 3 and Infragistic Grid.

Out of the columns I am showing in grid, first one is Hyerlink (used column template)

 

@(Html

  .Infragistics().Grid<SearchSummary>(Model.SearchResults.AsQueryable()).ID("wbGrid")  

.Columns( col => {  col.For(x => x.ID).HeaderText("ID").Template("<a id='lnkSummaryID' href='${ID}'>${ID}</a>");   

col.For(x => x.Name).HeaderText("Name");   

col.For(x => x.Date).HeaderText("Created Date"); })

.Features(features => { features.Selection().Mode(SelectionMode.Row).MultipleSelection(false).Activation(true); })

.Height("400px").DataBind().Width("800px").Render())

 

Now when the hyperlink (ID in first column) is clicked, I want row data. I am hooking a click event to hyperlink

$("#lnkSummaryID").live('click', function () {

     var row = $('#wbGrid').igGridSelection('selectedRow');

  });

 

Here row variable has innerText that gives me concatenated values of all columns corresponding to the selected row.

Can I get individual columns of the row using some king of index or column name ????

  • 1730
    Verified Answer
    posted

    Got the answer. Below is the code for accessing a single column:

    var rows = $('#wbGrid').igGridSelection('selectedRow');

    var dataview = $('#wbGrid').data('igGrid').dataSource.dataView();            

    var cellRowId = dataview[rows.element[0].rowIndex]["SummaryID"];