Infragistics.Win.UltraWinGrid.DoubleClickCellEvent c#
我正在做一个项目,当我点击一行两次时,我需要阅读基础设施网格列表中的一行Infragistics.Win.UltraWinGrid.DoubleClickCellEvent c#,c#,infragistics,ultrawingrid,C#,Infragistics,Ultrawingrid,我正在做一个项目,当我点击一行两次时,我需要阅读基础设施网格列表中的一行 try { if (txtAd.Text.Replace("'", "").Trim() == string.Empty && txtSoyad.Text.Replace("'", "").Trim() == string.Empty) { stBarMsg.Text = "ad soyad giril
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");
}
在这里,你可以找到我的双击功能
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");
}
}
“txtKartno.Text=grdList.Selected.Columns[0].ToString();”这行行不通,我想通过1按1获取每个属性的值。我的网格列表中有4列。有什么建议吗?当您双击Infragistics UltraWinGrid中的单元格时,您将收到在
DoubleClickCellEventArgs.cell
属性中单击的单元格。通过此属性,可以使用e.Cell.Row
语法访问当前行,也可以使用e.Cell.Row.Cells[columnName或columnIndex].Value语法访问该行中的任何其他单元格
因此,您需要的数据可以通过这种方式读取
txtKartno.Text = e.Cell.Row.Cells[0].Value.ToString();
(我假设所需的单元格不是单击的单元格,列位于索引零处)
当然,如果单击的单元格是您需要的单元格,则语法更简洁
txtKartno.Text = e.Cell.Value.ToString();
要完成回答,请注意,UltraGridRow有两种方法可用于从行中检索单元格值:
string textResult = e.Cell.Row.GetCellText(e.Row.Band.Columns[0]);
object objResult = e.Cell.Row.GetCellValue(e.Row.Band.Columns[1]);
根据Infragistics,这两种方法避免了创建不需要的单元格对象,因此性能更高。在您的情况下,不清楚这些方法是否真的有用。谢谢Steve,“txtKartno.Text=e.Cell.Row.Cells[0].Value.ToString();”效果很好。