I have a web data grid that when a user clicks on a row, another grid shows up with the the correct sub information (according to whichever row they clicked on) how do i get the cell data (to pass it as a parameter to the other grid) from what the user clicked on
Hi DMandy,
On the server-side you can do something like this when handling the RowSelectionChanged event:
protected void WebDataGrid1_RowSelectionChanged(object sender, Infragistics.Web.UI.GridControls.SelectedRowEventArgs e)
{
GridRecord selectedRow = e.CurrentSelectedRows[0];
DataRowView dataItem = (DataRowView)selectedRow.DataItem;
DataRow dr = dataItem.Row;
object[] valueArray = dr.ItemArray;
}
This pushes the cell values of the row into an ItemArray which you should be able to use as needed.
If you wanted to get the cell values client-side, you can do that there too:
function WebDataGrid1_Selection_RowSelectionChanged(sender, eventArgs)
var grid = $find("WebDataGrid1");
var rowindex = grid.get_behaviors().get_selection().get_selectedRows().getItemID(0).index;
alert(grid.get_behaviors().get_selection().get_selectedRows().getItem(0).get_element().innerText);
for (var i = 0; i < grid.get_behaviors().get_selection().get_selectedRows().getItem(0).get_cellCount(); i++)
alert(grid.get_rows().get_row(rowindex).get_cell(i).get_text());
Please let me know if you need any additional assistance.
Thank you! I know have it saved as a session
Dim pressName = e.CurrentSelectedCells(0).Text Session("PressName") = pressName
But the only time it updates the webdatagrid is when I refresh the page,
is it possible to call a refresh from the codebehind?
Are you supplying the datasource upon each post-back of the page? Would it be possible to include a small sample to show what you have and I can take a look at it for you.