Can you please let me know how to show particular row inside grid in edit mode Dynamically from code.
If I do radgridview.BeginEdit(),it is not specific to any row.
8 Answers, 1 is accepted
Please give us more specifics about your scenario and mainly the purpose of setting a whole row in edit-mode as for the time being only one cell can be in this mode.
You can find detailed information about editing in RadGridView in our online documentation.
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks for you reply.
I would like to know how can I set specific cell of specific row in edit mode.
I have grid which contains 10 rows.
I wish to set 5th row 1st column in eidt mode .
Something like answered in earlier post
http://www.telerik.com/community/forums/silverlight/gridview/putting-a-cell-into-edit-mode-in-code-behind.aspx
But i think now that solution does not work
Can you please update on the above ASAP
Please use as a reference this forum thread where you can download a sample project. However, instead of setting the selected cell to current, you can set it in edit-mode (in the method SetCurrentCell(GridViewCell cell):
cell.IsInEditMode = true;
All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks for reply.
I again hav confusion as I wish to set some cell in edit mode but here we searching that cell by text value.
Same value can exits in other cells too.
Please take another look at the same forum thread and you will find examples for both setting focus on cell by its value as well by its indices. The second one that uses indices of the columns and rows is the project you may use as a reference.
I hope that helps.
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
I Checked that thread,but my scenario is different.
1.)I m using dynamic datable to populate the data in grid
2.)I m adding the row on click of button as shown below
private void btnAdd_Click(object sender, RoutedEventArgs e)
{
#region
declaration
DataRow newItem;
#endregion
if (cmbnoOfrows.SelectedIndex != 0 && cmbnoOfrows.Text.ToString() != string.Empty)
{
for (int count = 0; count < int.Parse(cmbnoOfrows.Text.ToString()); count++)
{
newItem = engs.NewRow();
newItem[
"A"] = row;
newItem[
"B"] = cmbBusinessOrganization.SelectedValue.ToString();
newItem[
"C"] = cmbMGOOrganization.SelectedValue.ToString();
newItem[
"D"] = cmbBusinessSegment.SelectedValue.ToString();
newItem[
"E"] = cmbFiscalYr.SelectedValue.ToString();
row = row - 1;
engs.Rows.Add(newItem);
}
}
else
{
newItem = engs.NewRow();
;
newItem[
"A"] = row;
newItem[
"B"] = cmbBusinessOrganization.SelectedValue.ToString();
newItem[
"C"] = cmbMGOOrganization.SelectedValue.ToString();
newItem[
"D"] = cmbBusinessSegment.SelectedValue.ToString();
newItem[
"E"] = cmbFiscalYr.SelectedValue.ToString();
row = row - 1;
engs.Rows.Add(newItem);
}
if (engs.Rows.Count < 25)
{
radDataPager.Visibility =
Visibility.Collapsed;
}
else
{
radDataPager.Visibility =
Visibility.Visible;
}
dgEng.Rebind();
}
Now I wish to show the newly created rows selected.
I tried adding grid Layout updated event when i am writing above code, but that dint work out.
Please advice
What you can do in this case is to use the event of the grid Items_CollectionChanged and to define it in the following way:
void Items_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
this.RadGridView1.SelectedItems.Add(e.NewItems[0]);
}
}
I am sending you a sample project with the proposed solution. Furthermore, you may find additional information in this blog post.
Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.