Hey Admin,
I have once scenario I am binding records via asynchronous threading
Is there a way to not have the grid auto-scroll as data is going into it?
Thanks,
Shakti
I have once scenario I am binding records via asynchronous threading
delegate
void
RuleResultParameterDelegate(
string
value);
// this delegate is used to allow the code to call back to itself, as needed in the UI thread
private
void
RuleExecuted(
string
ruleResult)
{
// if this is not the main UI thread, then call this function via a delegate
if
(InvokeRequired)
{
BeginInvoke(
new
RuleResultParameterDelegate(RuleExecuted),
new
object
[] { ruleResult });
return
;
}
GridViewRowInfo row =
new
GridViewRowInfo(radGridView_EnvResults.MasterView);
row.Cells[
"colTargetHost"
].Value = “abc”;
row.Cells[
"colRuleName"
].Value = “efg”;
var selectedRow = radGridView_EnvResults.CurrentRow;
radGridView_EnvResults.Rows.Add(row);
if
(selectedRow !=
null
)
{
radGridView_EnvResults.GridBehavior =
new
MyBehavior();
}
}
public
class
MyBehavior : BaseGridBehavior
{
public
override
bool
ProcessKey(KeyEventArgs keys)
{
if
(
this
.GridControl.CurrentRow
is
GridViewNewRowInfo)
{
if
(keys.KeyData == Keys.Enter || keys.KeyData == Keys.Down || keys.KeyData == Keys.Up)
{
this
.GridControl.EndEdit();
this
.GridControl.GridNavigator.SelectPreviousRow(1);
this
.GridControl.GridNavigator.SelectFirstColumn();
this
.GridControl.BeginEdit();
}
else
if
(
this
.GridControl.GridNavigator.IsLastColumn(
this
.GridControl.CurrentColumn) && keys.KeyData == Keys.Tab)
{
this
.GridControl.EndEdit();
this
.GridControl.GridNavigator.SelectPreviousRow(1);
this
.GridControl.GridNavigator.SelectFirstColumn();
this
.GridControl.BeginEdit();
}
else
if
(keys.KeyData == Keys.Tab)
{
this
.GridControl.GridNavigator.SelectNextColumn();
}
return
true
;
}
else
{
return
base
.ProcessKey(keys);
}
}
}
Is there a way to not have the grid auto-scroll as data is going into it?
Thanks,
Shakti