Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 refreshing parent from child..but

Author  Topic 

jhermiz

3564 Posts

Posted - 2008-04-01 : 09:16:05
Im trying to refresh a parent page from a popup with this:


function ReturnDate()
{

window.opener.document.forms["<%= strFormName %>"].elements["<%= strCtrlName %>"].value = "<%= strSelectedDate %>";
window.opener.location=window.opener.location;
window.close();


}


Which works however when getting the date back from my calendar popup into a field on the parent page it always resets back take a look:



Notice 12/31/2008 always reverts back...
If I debug the code the text box never really gets 12/31/2008 it always has the session date in there.

Anyone know of a way to get this working a bit better. Do I need to use some sort of hidden fields on the parent page? Anyone have samples ?



Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-04-01 : 09:46:07
Why is your page doing postback when you select a date from the child window.There are lot of sample codes which prevent your page from doing a postback after the date selection.

The easiest one is the new Calendar Control of the AjaxControlToolkit.You can download it from here.

http://www.asp.net/ajax/ajaxcontroltoolkit/

It has some good working samples at

http://www.asp.net/ajax/ajaxcontroltoolkit/samples
Go to Top of Page

jhermiz

3564 Posts

Posted - 2008-04-01 : 09:51:29
quote:
Originally posted by ayamas

Why is your page doing postback when you select a date from the child window.There are lot of sample codes which prevent your page from doing a postback after the date selection.

The easiest one is the new Calendar Control of the AjaxControlToolkit.You can download it from here.

http://www.asp.net/ajax/ajaxcontroltoolkit/

It has some good working samples at

http://www.asp.net/ajax/ajaxcontroltoolkit/samples




This site is not an ajax site.
Please read the post first as you see it is a standard asp.net web page. I know you dont have to do the post back in ajax based controls, that is not my question.



Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-04-01 : 10:13:57
I did not say that your site has to be an ajax site.I just gave you an another alternative which was the easiest with least code.It is a standard method in any web application to prevent post backs after a date is selected from a child window.There are tons of sample codes on the web.
One of them can be seen here

http://www.dotnetjohn.com/runtime/GetDates.aspx

The source code is available here

http://www.dotnetjohn.com/Articles.aspx?articleid=67

And by the way please check the javascript error when you click the button for date popup.Maybe because of that the page is doing a postback.

Go to Top of Page

jhermiz

3564 Posts

Posted - 2008-04-01 : 10:27:35
quote:
Originally posted by ayamas

I did not say that your site has to be an ajax site.I just gave you an another alternative which was the easiest with least code.It is a standard method in any web application to prevent post backs after a date is selected from a child window.There are tons of sample codes on the web.
One of them can be seen here

http://www.dotnetjohn.com/runtime/GetDates.aspx

The source code is available here

http://www.dotnetjohn.com/Articles.aspx?articleid=67

And by the way please check the javascript error when you click the button for date popup.Maybe because of that the page is doing a postback.





I dont think you understand the issue.
My calendar DOES NOT DO a post back when it sends the value to the text box on the parent page. The refresh happens because I want to refresh the grid inside the parent page, not because the date is sent.



Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-04-01 : 10:34:43
Yup now I understood.Then maybe you will have to set some session variable on the child page close & on the page load of the parent page check the value in session variable if not nothing then set the value of the textbox of the session variable.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2008-04-01 : 10:51:40
quote:
Originally posted by ayamas

Yup now I understood.Then maybe you will have to set some session variable on the child page close & on the page load of the parent page check the value in session variable if not nothing then set the value of the textbox of the session variable.



Ya I think I'll just take that route, was trying to avoid using more session variables, and I think I could get away with using hidden fields..but I need to get a quick solution for now.

Thanks for understand the problem!

Weblog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page
   

- Advertisement -