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
335
cell selection changes
posted

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

Parents
No Data
Reply
  • 10240
    Verified Answer
    posted

    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.

Children