I was working on a project and I need to read a row in a Infragistics GridList when I clicked twice on the row.This is how I filled my girdlist
try
{
if (txtAd.Text.Replace("'", "").Trim() == string.Empty && txtSoyad.Text.Replace("'", "").Trim() == string.Empty)
{
stBarMsg.Text = "ad soyad girilmeli!";
return;
}
DataTable dt = PrePaidLib.getParaPuanGoruntulemeList(true, txtAd.Text.Replace("'", ""), txtSoyad.Text.Replace("'", ""));
grdList.DataSource = dt;
grdList.DataBind();
}
catch (Exception exp)
{
ErrorLib.ErrorHandle(exp, "frmParaPuanGoruntuleme.retrieveRecord");
}
Here, you can find my double click function
private void grdList_DoubleClickCell(object sender, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs e)
{
try
{
txtKartno.Text = grdList.Selected.Columns[0].ToString();//Cells[1].ToString();
}
catch(Exception ex)
{
ErrorLib.ErrorHandle(ex, "grdList_DoubleClickCell");
}
}
This line doesn’t work “txtKartno.Text = grdList.Selected.Columns[0].ToString();” By the way I want to get values for each attribute 1 by 1. I have 4 columns in my gridlist. Any suggestions?
When you double click a cell in an Infragistics UltraWinGrid, you receive the cell clicked in the
DoubleClickCellEventArgs.Cellproperty. From this property you can reach the current Row using thee.Cell.Rowsyntax and from that row you can reach any other cell using thee.Cell.Row.Cells[columnName or columnIndex].Valuesyntax.So the data you need could be read in this way
(I’m assuming the cell required is not the one clicked and the column is at index zero)
Of course if, the clicked cell is the one you need, the syntax is more concise
To complete the answer, please note, the UltraGridRow has two methods that can be used to retrieve a cell value from a row:
According to Infragistics, these two methods avoid the creation of unneeded cells object and therefore are more performant. In your case, it’s not clear if these methods are really beneficial.