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
50
Grid DataItem on ClientSide
posted

Hi,

I have a WebDataGrid which is bound to a List.

I want to be able to get an item from the list using clientside JavaScript.  The item in question is not actually displayed on the list.

This is possible in codebehind by doing the following:

 

Dim

 

l_Absnece As AbsenceImport = grdAdditional.Behaviors.Selection.SelectedRows(0).DataItem

 

 

Return l_Absnece.Exception

I have tried similar in javascript but can't seem to get the actual object that the row is bound to. 

So I tried to get the ID for the Item, put it into a hidden variable and then run a .Net function within the Javascript to return the item.  :

var Grid = $find(GridClientID);
var SelectedRows = Grid.get_behaviors().get_selection().get_selectedRows();
if (SelectedRows._rows._rows.length > 0){
 var Row = SelectedRows.getItem(0);
        var AbsenceID = Row.get_cell(0).get_value();  
        var hdnValue = document.getElementById('<%= hdnValueID %>');
 hdnValue.value = AbsenceID;
 var txtException = '<%= CurrentRowException %>';
}

However the hidden value is not being seen by the .Net at this point.

My question is how to resolve this issue, is there a neat way to achieve what I'm trying to do?