Click here to Skip to main content
15,891,835 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
1. I have a GridView in a Parent page and the same GridView in a ModalDialog as Child page.

2. On a button click from parent page with the below javaScript I will be opening the required child ModalDialog.
JavaScript
var returnValue = window.showModalDialog(url, "windows Arguements #1", "dialogHeight: 700px; dialogWidth: 1100px; scroll: No; edge: Raised; center: Yes; resizable: No; titlebar=No; toolbar=No; status: Yes;");


3. Here in ModalDialog page I may edit the values in the GridView or I may add new Rows or Delete the existing rows, and the same will be saved using save button, by clicking which I will be calling the below javaScript
JavaScript
window.returnValue = rowscount + "::~~::~~::~~::" + document.getElementById('<%= ChildGridviewID.ClientID %>').outerHTML;


4. On closing the child ModalDialog it continues the javaScript after the step mentioned in "Step : 2" as below :
JavaScript
var params = returnValue.split("::~~::~~::~~::");
var rowscount = params[0];
var outer = params[1];
debugger;
document.getElementById(ParentGridviewID).outerHTML = outer;


Which updates the edited values in the TextBox, DropDown template fields but doesnot reflect the any newly added or deleted rows .
Posted
v3
Comments
rakeshdudi 17-Sep-13 11:56am    
Hie...Tadit Dash, thank you for helping in updating my question...
Would be much helpful if provided with answer
GregWyatt 17-Sep-13 14:44pm    
I am trying to more fully understand the problem. I have done similar things using a hidden div that would over lay on top of the current page with a grey background when opened. Then when someone submits, the dialog(div) is rehidden and the changes are updated on the underlying page. Are you using a similar mechanism, by just showing a div or are you using an asp.net modal dialog control? Or have I completely misunderstood your implementation?
rakeshdudi 18-Sep-13 2:07am    
You are very close to my question GregWyatt, but the thing is that I am not using (div) to populate the dialog. I am using ModelDialog which will open in a new page as a popup, but where as using dialogue(div) will open as you explained whose controls will be still accessible to the so called parent page because the div region will be present in the same page which will be populated and hided as per on some button click(may be by using ModelpopupExtender).
GregWyatt 18-Sep-13 8:06am    
I am unfamiliar with the implementation your using, but thought I would throw out a few ideas. If your javascript is successfully updating some elements on the page, could you call a button click that will cause a partial postback to update your gridview? This would require the gridview to be in an update panel and the button could be inside the update panel as well, hidden so that no one can use it but your javascript call.
rakeshdudi 19-Sep-13 2:38am    
Awsome GregWyatt... you are absolutely right!!! I knew that it is an alternative but the issue that I am facing over doing that is... when calling button click immedialtely after var returnValue = window.showModalDialog( ... ) in javascript its triggering pageload but not the button click.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900