Hello,
I am using Prometheus radgrids in a business grid/details grid scenario. Before inserting a new item, I attempt to clear out any preexisting items to ensure that the user only sees one item at a time. In the BusinessGrid_ItemCommand event when e.CommandName="AddDetail" I attemp to clear any existing items to accomplish this. However, when I debug I find that detailsGrid.Items.Count = 1 before and after calling detailsGrid.MasterTableView.ClearEditItems so it doesn't seem to work. This causes multiple items to show in the detailsGrid which is not the behavior I want. There doesn't seem to be another way to clear the detailsgrid items. (I tried detailsGrid.EditIndexes.Clear, detailsGrid.MasterTableView.ClearSelectedItems(), etc but nothing works.) The code where I attempt to clear the items is below. Thanks in advance for your help.
Erin
protected void BusinessGrid_ItemCommand(object source, GridCommandEventArgs e)
{
switch (e.CommandName)
{
case "AddDetail":
detailsGrid.EditIndexes.Clear();
detailsGrid.MasterTableView.ClearEditItems();
//detailsGrid.MasterTableView.Items.Count still equals 1 here...
detailsGrid.MasterTableView.IsItemInserted = true;
detailsGrid.MasterTableView.Visible = true;
detailsGrid.Rebind();
break;
}
}
I am using Prometheus radgrids in a business grid/details grid scenario. Before inserting a new item, I attempt to clear out any preexisting items to ensure that the user only sees one item at a time. In the BusinessGrid_ItemCommand event when e.CommandName="AddDetail" I attemp to clear any existing items to accomplish this. However, when I debug I find that detailsGrid.Items.Count = 1 before and after calling detailsGrid.MasterTableView.ClearEditItems so it doesn't seem to work. This causes multiple items to show in the detailsGrid which is not the behavior I want. There doesn't seem to be another way to clear the detailsgrid items. (I tried detailsGrid.EditIndexes.Clear, detailsGrid.MasterTableView.ClearSelectedItems(), etc but nothing works.) The code where I attempt to clear the items is below. Thanks in advance for your help.
Erin
protected void BusinessGrid_ItemCommand(object source, GridCommandEventArgs e)
{
switch (e.CommandName)
{
case "AddDetail":
detailsGrid.EditIndexes.Clear();
detailsGrid.MasterTableView.ClearEditItems();
//detailsGrid.MasterTableView.Items.Count still equals 1 here...
detailsGrid.MasterTableView.IsItemInserted = true;
detailsGrid.MasterTableView.Visible = true;
detailsGrid.Rebind();
break;
}
}
9 Answers, 1 is accepted
0
Hello Erin,
ClearEditItems() and ClearSelectedItems() methods are designed to put all edited/selected items in normal mode not to clear items. You can use PageSize="1" and PagerStyle.Visible = false if you want only one item in the grid.
Regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
ClearEditItems() and ClearSelectedItems() methods are designed to put all edited/selected items in normal mode not to clear items. You can use PageSize="1" and PagerStyle.Visible = false if you want only one item in the grid.
Regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Erin
Top achievements
Rank 1
answered on 04 Apr 2008, 05:39 PM
Hi Vlad,
Thanks for your reply. I tried setting pagesize="1" and pagerstyle-visible="false" in my detailsGrid but unfortunately that doesn't solve my problem. I still end up with 2 items showing up in my detailsGrid. Here's the steps to reproduce the problem:
//assume we have a businessGrid that contains one or more items and a detailsGrid
1) Click on a row in the businessGrid -> the detailsGrid shows the details of the row. (Please note if you don't do this 1st step the problem does not occur)
2)Click on the "Add" button in the businessGrid -> the detailsGrid now shows the insert form only (i.e there is only 1 item showing in the details grid at this point)
3)Enter information in the form that contains errors and click on "Insert" -> the validation fires and you are alerted of the errors (there is still only 1 item showing at this point)
4)Leave the invalid data and click "insert" again. This time the detailsGrid shows 2 items, the form for the item you are trying to add along with another form that looks like its in edit mode (the update button displays). I don't want this 2nd form to show up. How do I stop this behavior?
Thanks for your help
Thanks for your reply. I tried setting pagesize="1" and pagerstyle-visible="false" in my detailsGrid but unfortunately that doesn't solve my problem. I still end up with 2 items showing up in my detailsGrid. Here's the steps to reproduce the problem:
//assume we have a businessGrid that contains one or more items and a detailsGrid
1) Click on a row in the businessGrid -> the detailsGrid shows the details of the row. (Please note if you don't do this 1st step the problem does not occur)
2)Click on the "Add" button in the businessGrid -> the detailsGrid now shows the insert form only (i.e there is only 1 item showing in the details grid at this point)
3)Enter information in the form that contains errors and click on "Insert" -> the validation fires and you are alerted of the errors (there is still only 1 item showing at this point)
4)Leave the invalid data and click "insert" again. This time the detailsGrid shows 2 items, the form for the item you are trying to add along with another form that looks like its in edit mode (the update button displays). I don't want this 2nd form to show up. How do I stop this behavior?
Thanks for your help
0
Hello Erin,
Unfortunately I'm unable to reproduce this unwanted behavior on my end. I attached a simple test page which I assembled for you. Can you please give it a try and see if I'm missing something obvious? Please feel free to modify the page thus making the problematic behavior surface and send it back attached to a formal support ticket. Thus we will do everything possible to provide up-to-the-point answer/solution.
Best regards,
Rosen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Unfortunately I'm unable to reproduce this unwanted behavior on my end. I attached a simple test page which I assembled for you. Can you please give it a try and see if I'm missing something obvious? Please feel free to modify the page thus making the problematic behavior surface and send it back attached to a formal support ticket. Thus we will do everything possible to provide up-to-the-point answer/solution.
Best regards,
Rosen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Erin
Top achievements
Rank 1
answered on 08 Apr 2008, 09:59 PM
Hi Rosen,
Thank you for looking into this for me. I looked at the example you submitted. Your example uses DetailTables in the radGrid. I am not using the DetailTables in the radgrid but rather 2 separate radGrids, where one of them acts as the detailsgrid. My scenario is the same as one of your sample projects: Telerik Trial\Live Demos\Grid\Examples\Programming\BusinessGrid\DefaultCS.aspx
My code is similar to the code in that example so hopefully you can understand my problem better with that in mind.
Thanks for your help,
Erin
Thank you for looking into this for me. I looked at the example you submitted. Your example uses DetailTables in the radGrid. I am not using the DetailTables in the radgrid but rather 2 separate radGrids, where one of them acts as the detailsgrid. My scenario is the same as one of your sample projects: Telerik Trial\Live Demos\Grid\Examples\Programming\BusinessGrid\DefaultCS.aspx
My code is similar to the code in that example so hopefully you can understand my problem better with that in mind.
Thanks for your help,
Erin
0
Hello Erin,
If I understand you correctly when the InsertForm is not submitted (due to a validation error for example) and a record in Master grid is clicked the edit form appears, too. Am I right? If this is the case you should explicitly close the insert form. For example :
Kind regards,
Rosen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
If I understand you correctly when the InsertForm is not submitted (due to a validation error for example) and a record in Master grid is clicked the edit form appears, too. Am I right? If this is the case you should explicitly close the insert form. For example :
| protected void BusinessGrid_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| switch (e.CommandName) |
| { |
| case "RowClick" : |
| if (DetailsGrid.MasterTableView.IsItemInserted) |
| { |
| DetailsGrid.MasterTableView.IsItemInserted = false; |
| DetailsGrid.Rebind(); |
| } |
| break; |
| default: |
| break; |
| } |
| } |
Kind regards,
Rosen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Brian
Top achievements
Rank 1
answered on 18 Apr 2008, 06:53 PM
That was good. Worked for me...
Brian
Brian
0
Erin
Top achievements
Rank 1
answered on 21 Apr 2008, 09:07 PM
Hi Rosen,
Thanks for your reply. Thats not quite the case. When I do the scenario you explained and click on the row, the data shows up in readonly as I would like it. The problem for me only occurs in the scenario I explained where I initially click a row (which causes detailsGrid.Items.Count to be 1) and click 'New' and try to unsuccessfully add an item twice. (I end up with the undesirable behavior where 2 forms show up in the detailsGrid) I have the code you mentioned already and the problem still occurs. The problem seems to be when the detailsGrid.Items.Count = 1 prior to to making a new item and if I could just remove that item somehow I could fix it. Is there no way to do this?
Thanks for looking into this.
Erin
Thanks for your reply. Thats not quite the case. When I do the scenario you explained and click on the row, the data shows up in readonly as I would like it. The problem for me only occurs in the scenario I explained where I initially click a row (which causes detailsGrid.Items.Count to be 1) and click 'New' and try to unsuccessfully add an item twice. (I end up with the undesirable behavior where 2 forms show up in the detailsGrid) I have the code you mentioned already and the problem still occurs. The problem seems to be when the detailsGrid.Items.Count = 1 prior to to making a new item and if I could just remove that item somehow I could fix it. Is there no way to do this?
Thanks for looking into this.
Erin
0
Accepted
Hi Erin,
I have attached a simple project that demonstrates the BusinessGrid example. Can you give it a spin and see if I'm leaving something out.
All the best,
Rosen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I have attached a simple project that demonstrates the BusinessGrid example. Can you give it a spin and see if I'm leaving something out.
All the best,
Rosen
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Erin
Top achievements
Rank 1
answered on 27 Apr 2008, 08:14 PM
Hi Rosen,
Thank you for attaching the sample code. I realized my DetailsGrid_ItemCommand was missing the code:
Thank you for attaching the sample code. I realized my DetailsGrid_ItemCommand was missing the code:
case RadGrid.PerformInsertCommandName:
BusinessGrid.MasterTableView.CurrentPageIndex = BusinessGrid.MasterTableView.PageCount - 1;
BusinessGrid.Rebind();
Now that I have added that code it seems to be working correctly. Thanks again for your help.
Erin
