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
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?
Hello Martin,
On the client side you can access only the values that are rendered.
If you have hidden the column containing the requested value you can use EnableHiddenSelection :
<ig:Selection CellClickAction="Row" RowSelectType="Single" EnableHiddenSelection="true">
</ig:Selection>
If you want to access the DataItem I recommend you using the server side event for the purpose.
http://community.infragistics.com/forums/p/56404/288965.aspx#288965
Let me know if you need further assistance regarding this.