refresh gridview on parent form after modal child form closed [modified]
-
hi i've got a gridview on a parent webform. after closing a child form that was opened in modal mode i want the gridview to be refreshed. now i have tried several things that dont work and i dont know why: 1. tried to use: __doPostBack(buttonName,'') in javascript methode but nothing happened. this is the code i have used: code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
//btnNewChore:the button that activates the modal dialog
//btnRefresh: the button that shld activate the gridView refreshingbtnNewChore.OnClientClick = "javascript:OpenChild( theURLOfTheChildForm, btnRefresh.ID)";
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
gridViewChores.DataBind();
}Javascript:
function OpenChild(theURLOfTheChildForm,targetButton)
{var winSettings = "center:yes;resizable:no;dialogHeight:300px" var returnValue = window.showModalDialog(URL, "", winSettings ); if (returnValue == null) { window.alert("NO chore was created!"); } else { \_\_doPostBack(btnName,''); }
2.i've also tried to use document.all("btnRefresh").click(); instead of __doPostBack but i've got an error :document.all("... not an object etc... Thank you in advance for your help yohay
modified on Monday, September 22, 2008 9:12 AM
-
hi i've got a gridview on a parent webform. after closing a child form that was opened in modal mode i want the gridview to be refreshed. now i have tried several things that dont work and i dont know why: 1. tried to use: __doPostBack(buttonName,'') in javascript methode but nothing happened. this is the code i have used: code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
//btnNewChore:the button that activates the modal dialog
//btnRefresh: the button that shld activate the gridView refreshingbtnNewChore.OnClientClick = "javascript:OpenChild( theURLOfTheChildForm, btnRefresh.ID)";
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
gridViewChores.DataBind();
}Javascript:
function OpenChild(theURLOfTheChildForm,targetButton)
{var winSettings = "center:yes;resizable:no;dialogHeight:300px" var returnValue = window.showModalDialog(URL, "", winSettings ); if (returnValue == null) { window.alert("NO chore was created!"); } else { \_\_doPostBack(btnName,''); }
2.i've also tried to use document.all("btnRefresh").click(); instead of __doPostBack but i've got an error :document.all("... not an object etc... Thank you in advance for your help yohay
modified on Monday, September 22, 2008 9:12 AM
I had this same problem. I never found a solution, I ended up using window.redirect('samePage.aspx'); I had used the code in the modal window to save the parameters in session state. Then when the parent page reloaded it used the new parameters to bind the grid.
I didn't get any requirements for the signature
-
hi i've got a gridview on a parent webform. after closing a child form that was opened in modal mode i want the gridview to be refreshed. now i have tried several things that dont work and i dont know why: 1. tried to use: __doPostBack(buttonName,'') in javascript methode but nothing happened. this is the code i have used: code behind:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
//btnNewChore:the button that activates the modal dialog
//btnRefresh: the button that shld activate the gridView refreshingbtnNewChore.OnClientClick = "javascript:OpenChild( theURLOfTheChildForm, btnRefresh.ID)";
}
protected void btnRefresh_Click(object sender, EventArgs e)
{
gridViewChores.DataBind();
}Javascript:
function OpenChild(theURLOfTheChildForm,targetButton)
{var winSettings = "center:yes;resizable:no;dialogHeight:300px" var returnValue = window.showModalDialog(URL, "", winSettings ); if (returnValue == null) { window.alert("NO chore was created!"); } else { \_\_doPostBack(btnName,''); }
2.i've also tried to use document.all("btnRefresh").click(); instead of __doPostBack but i've got an error :document.all("... not an object etc... Thank you in advance for your help yohay
modified on Monday, September 22, 2008 9:12 AM
Is the other page that's being opened an aspx page? If it is, you can try declaring an object type of formview in the popups code behind. For ex. FormView fv = new FormView(); fv = (FormView)this.Parent.FindControl("NameOfFormView"); fv.DataBind(); However, I used AJAX's modalpopupextender on an ascx User Control that was on my page, so I hope it will work for you too. There is a possibility Parent may need to be in there more than once depending upon the levels.