I'm having an issue with the GridView. I'd like to be able to dynamically make appear the AddNewRow control. By default I set the AllowAddNewRow=false, but if the user clicks on The "Add New Row" menu item, I'd like for the NewRow control to appear on the grid, after I set the AllowAddNewRow=true. But I can not find a way to redraw or reload the entire grid for it to appear. Is this even possible?
The gridview is on a form, do I have to reload the whole form for this work?
I am using version 2014.2.715.40.
Thanks for the help
P.S. A little sample of the method called dynamically:
public void New()
{
radGridPilotage.MasterTemplate.BeginUpdate();
radGridPilotage.AllowEditRow = true;
radGridPilotage.MasterTemplate.AllowAddNewRow = true;
radGridPilotage.MasterTemplate.EndUpdate();
radGridPilotage.Update();
}
The gridview is on a form, do I have to reload the whole form for this work?
I am using version 2014.2.715.40.
Thanks for the help
P.S. A little sample of the method called dynamically:
public void New()
{
radGridPilotage.MasterTemplate.BeginUpdate();
radGridPilotage.AllowEditRow = true;
radGridPilotage.MasterTemplate.AllowAddNewRow = true;
radGridPilotage.MasterTemplate.EndUpdate();
radGridPilotage.Update();
}
5 Answers, 1 is accepted
0
Dario
Top achievements
Rank 1
answered on 28 Nov 2014, 04:20 PM
I figured out the right way to do this. But now I am having trouble switching the AllowEditRow=True dynamically. Is this possible or is it only possible at design time?
Thank-you
Thank-you
0
Hello Dario,
Thank you for writing.
You should be able to easily show/hide the add new row, and you do not need to use any Begin/End update blocks in this case:
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Thank you for writing.
You should be able to easily show/hide the add new row, and you do not need to use any Begin/End update blocks in this case:
private
void
radButton1_Click(
object
sender, EventArgs e)
{
radGridView1.AllowAddNewRow = !radGridView1.AllowAddNewRow;
}
I hope this helps. Should you have any other questions do not hesitate to ask.
Regards,
Dimitar
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Dario
Top achievements
Rank 1
answered on 01 Dec 2014, 01:47 PM
Thank-you for the response Dimitri. To explain a little more my situation, The grid is on a form that is a child to a parent form. Now if I add a button on the child form, all works well. The problem is that the click actio is coming from the parent form. I found a work around for the AddNew. I basically add a new row to the binded Dataset then call the grid.Rows.AddNew() and it adds a new row to my grid, which is actually the wanted behavior.
My new problem is trying to do the same with an Edit click on the parent form(in a menu). I found that you can turn the edit of a cell on or off on the CellClick action, but I need to know how, and if it's even possible, to find the index of the cell that is clicked. I would like to use this code, unless you know of a better way:
Dario
My new problem is trying to do the same with an Edit click on the parent form(in a menu). I found that you can turn the edit of a cell on or off on the CellClick action, but I need to know how, and if it's even possible, to find the index of the cell that is clicked. I would like to use this code, unless you know of a better way:
e.Row.Cells[cellIndex].BeginEdit();
Dario
0
Dario
Top achievements
Rank 1
answered on 01 Dec 2014, 07:32 PM
Rookie mistake. I just had to prefix my grid with "this." Now all works as it should. hanks for all your help Dimitar.
0
Hello Dario,
Thank you for writing back.
I am glad that everything is working fine on your side now. Do not hesitate to contact us if you have other questions.
Regards,
Dimitar
Telerik
Thank you for writing back.
I am glad that everything is working fine on your side now. Do not hesitate to contact us if you have other questions.
Dimitar
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.