1 Solution
Hello Ruben,
Your scenario seems to be complex. It is hard to suggest an optimal solution without knowing implementation details. However, I will try.
1. The ASPxGridView.HtmlEditFormCreated event is raised for every GridView whose edit form is opened. If a user has opened Edit Forms of several detailed ASPxGridViews, the event of each grid is raised.
2. The easiest solution for this issue is to allow a user to open only one detailed 'D' ASPxGridView at the same time. You can achieve this by enabling the ASPxGridView.SettingsDetail.AllowOnlyOneMasterRowExpanded setting of the 'C' grid.
If this does not meet your requirements, would you please send us a test project that we can use to investigate the issue on our side?
Updated:
We have analyzed the issue and suggest you slightly modify the previous solution. I have attached a modified sample.
-
Hi Vladimir,
Thank you for your explanation. However as i said earlier, we cannot limit the expanding of the "C" grid since thats the functionatility.
I would like you to take a look at this "http://www.devexpress.com/Support/Center/p/Q270739.aspx". I have the exact same issue in limiting the edit mode. But that solution only works when all the master rows are expanded. What if an user expand First row of "C" first and Click edit of first row of "D" and directly goes to third row of "C" and Click edit of first row of "D"?? In that situation the previously opened edit page should close.
Kindly analyse in this part. I hope i gave you an understandable explanation. I will attach my Test Project soon regarding that "ASPxGridView.HtmlEditFormCreated ".
Again thank you for helping me in this issue. -
Ruben, thank you for your explanation.
Your scenario seems to be complex. I would like to examine it to suggest the most appropriate solution to this issue. Would you please provide me with a test project for investigation? -
Vladimir,
First i thank you for your swift response. I appreciate it. Since there is a time constraint, we decided to opt the solution you suggested. ie., Closing the edit form when another one is opened.
So here we have a solution provided by Mr.Mike (from Devexpress support) in the link "http://www.devexpress.com/Support/Center/p/Q270739.aspx".
He has given a good solution for that. However im afraid that it doesn't meet the full requirement. I have attached the sample project provided by him. Kindly go through it as follows:
1. Expand the first master row and click edit in the first row.
2. Expand the second master row and click edit in the first row.
3. Now the edit form in the first master row should close.
Very simple to explain isn't it? :) I hope you understand the problem and provide me a good solution.
Thank you Vladimir. -
Vladimir,
Im bit worried to face the strange things happening. I was trying to make it work atleast in a way what Mike had provided. I have four grids inside. That code is working fine in all other grids but not in the last one. Im afraid since we use separate edit form inside the last grid, i don't work i guess. I have attached the aspx code of the last two grids. In the last grid we use separate edit form inside a template. May be it would cause the problem. Please analyse and help me in this. I hope you would provide a good solution for the last one and for this one.Please dont think im troubling. I will be happy if this one gets resolved. -
We have analyzed the issue and suggest you slightly modify the previous solution. I have attached a modified sample to my Answer above.
I am not sure about the second issue described in your last post. If the EditForm template is implemented correctly, I do not think that using the template can be the cause of the issue.
Would you please modify the provided sample to illustrate this issue for us? -
Vladimir ,
Thank you so much. I gonna try it now in my project. Can you please attach the project in VB. Cuz i got an error while implementing the code you have given.In "BeforeCallBackGetResult" Event, i cannot do this following operation.
Dim grid As ASPxGridView = TryCast(sender, ASPxGridView)
If grid <> UniqueresourceGrid Then
grid.CancelEdit()
End IfI got an error saying, "Operator '<>' is not defined for types 'DevExpress.Web.ASPxGridView.ASPxGridView' and 'DevExpress.Web.ASPxGridView.ASPxGridView'."
Thank you.
-
Hello Ruben,
There is no need to use server code. The code in my sample is my previous attempt. I have updated the attachment with corrected projects in both languages: C# and VB.NET -
Vladimir,
Awesome. Yeah It works. You solved one of my greatest problem. Thank you for that. Im happy. Thank you Vladimir and Thank you Devexpress for this good helping support. -
Hi Vladimir,
One final thing. The limiting of edit mode works great. Im happy with that. But i have to do the same thing for New mode too. I tried the script as follows. But it din't work.
<script language="javascript" type="text/javascript">
var detailGrids = {};
function DetailGrid_Init(s, e) {
detailGrids[s.name] = s;
}
function DetailGrid_BeginCallback(s, e) {
if((e.command == "STARTEDIT") || (e.command == "ADDNEWROW')) {
for(var key in detailGrids) {
var grid = detailGrids[key];
if(grid.GetMainElement() && (grid.IsEditing() || grid.IsNewrowEditing))
grid.CancelEdit();
}
}
}
</script>
Can you specify the command name for New mode too or alter the Test project you have updated. That would be helpful.
Thanks. -
I have noticed a typo in your code. The ADDNEWROW string is started from the quotation marks ("), but closed with a single straight quotation mark ('). Please fix it ant test the solution again.
-
Vladimir,
I really Thank you for your support. Since i was busy i couldnt reply you ASAP. Anyways, your assistance was really great and it was helping me a lot. Thanks again. Peace. -
Thank you for taking the time to respond with such kind words. It is really important for us to know that our customers are happy with our service. This greatly motivates us in our work. :)
Should you face any other issue, feel free to contact us at any time.
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+