private void radGridView1_CellClick(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
GridViewCellInfo cell = (GridViewCellInfo)radGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cell.Tag != null)
{
Process.Start(cell.Tag.ToString());
}
}
Hello,
I have a gridview bound to an entity framework collection. To update to database I refresh my collection followed by gridview.Refresh. This works as expected when I change fields of existing entities.
However, when I add a new entity into the collection, the gridview does not reflect the insertion unless I set its DataSource to null and back to my collection. How can I force a rebind without completely resetting the gridview state like that?
Thanks.
private void exporter_ExcelCellFormatting(object sender, ExcelCellFormattingEventArgs e)
{
if (e.GridRowInfoType == typeof(GridViewDataRowInfo))
{
//update progress bar
int position = (int)(100 * (double)e.GridRowIndex / (double)(GetVisibleRows(this.radGridView.ChildRows)));
this.UpdateProgressBar(position);
this.radProgressBar.IndicatorElement1.UpdateLayout();
}
}
public long GetVisibleRows(GridViewChildRowCollection rows)
{
long i = 0;
foreach (GridViewRowInfo row in rows)
{
if (row is GridViewGroupRowInfo)
{
i += GetVisibleRows(row.ChildRows);
continue;
}
i += 1;
}
return i;
}
private void UpdateProgressBar(int value)
{
if (this.InvokeRequired)
{
this.Invoke(new EventHandler(delegate
{
if (value < 100)
{
this.radProgressBar.Value1 = value;
}
else
{
this.radProgressBar.Value1 = 100;
}
}));
}
else
{
if (value < 100)
{
this.radProgressBar.Value1 = value;
}
else
{
this.radProgressBar.Value1 = 100;
}
}
}
Thanks