Monday, March 26, 2012

Main Web Page interacting with Search Web Page

I have for purposes of this discussion two web forms I'm working with : i)
main.aspx, ii) find.aspx. From the main web form I have a button control
that opens a modeless dialog (find.aspx,,,) etc... From the search page
[find.aspx], I have several web controls that are used to control a query
from SQL database [ex: name, location, start date, end date, rule #, etc...]
.
Overview - I open the modeless dialog without issue from main form
[main.aspx]. I control the query without issue in the search form
[find.aspx]. I've set the tag <base target=_self> to ensure requeries from
the search page repost to the same page - find.aspx.
Objective - After I update the search page with a table datasets (that's
dynamically constructed based on search criteria - and no issue / works
perfect), I also have created the first table column as an "anchor - via <a
href [some unique id] onclick event=[some javascript function]>. What I WAN
T
to do is from the search page, depress ANY entry from the first column of
table - and have this unique ID saved as session variable / than have the
main web page update itself accordingly based on the ID selected.
ISSUE/HELP!!! - I'm not able to force the main page to repost and read the
session state variable! Is this possible / using a search page to tell the
main page to update itself - how do I do this?
NOTE: I'm not using frames - and not sure how to tell system to have parent
repost - something like window.parent.opener.navigate(main.aspx) / this
doesn't work - but this is goal - use the modeless form to query database /
have the main page update itself based on selection from search page.
Kind regards for help/assistance in this matter,
DavidThis article is a bit old, but I think it will clearly illustrate an easy wa
y
to do this:
http://www.eggheadcafe.com/articles/20060117.asp
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net
"DavidS" wrote:

> I have for purposes of this discussion two web forms I'm working with : i)
> main.aspx, ii) find.aspx. From the main web form I have a button control
> that opens a modeless dialog (find.aspx,,,) etc... From the search page
> [find.aspx], I have several web controls that are used to control a query
> from SQL database [ex: name, location, start date, end date, rule #, etc..
.].
> Overview - I open the modeless dialog without issue from main form
> [main.aspx]. I control the query without issue in the search form
> [find.aspx]. I've set the tag <base target=_self> to ensure requeries from
> the search page repost to the same page - find.aspx.
> Objective - After I update the search page with a table datasets (that's
> dynamically constructed based on search criteria - and no issue / works
> perfect), I also have created the first table column as an "anchor - via <
a
> href [some unique id] onclick event=[some javascript function]>. What I W
ANT
> to do is from the search page, depress ANY entry from the first column of
> table - and have this unique ID saved as session variable / than have the
> main web page update itself accordingly based on the ID selected.
> ISSUE/HELP!!! - I'm not able to force the main page to repost and read the
> session state variable! Is this possible / using a search page to tell th
e
> main page to update itself - how do I do this?
> NOTE: I'm not using frames - and not sure how to tell system to have paren
t
> repost - something like window.parent.opener.navigate(main.aspx) / this
> doesn't work - but this is goal - use the modeless form to query database
/
> have the main page update itself based on selection from search page.
> Kind regards for help/assistance in this matter,
> David
>
>
The article is an excellent one. But I think for my purposes it's limited i
n
what I currently doing.
1) The popup I open is required to remain opened after selecting an item
associated with the search query - the popup from the example uses the Close
button and than the associated window.opener.update( ret ); to force the
postback - I believe.
2) Issue I'm having is I don't want to close the current window after a post
- hence / simple solution would be to remove the window.close in the
Page_Load.Done() function - but I believe after a repost, the popup would
either repost itself in a new window too - hence I used <target =_base> to
ensure new posts are always the same window. Upon doing this - I believe
window.opener is now undefined - doesn't point to main form again!
I can't seem to force the main window to repost - repaint etc... /
window.opener is undefined after I depress the Submit button on search page
-
since i) it will do SQL query of data; ii) update form with what it's found.
Is there anyway to have the Handle for the main page - saved - and then use
this handle in the popup I have in some way to force the main window to
update?
something like <hwnd of main page>.update() - I can call this from my
javascript from from the popup - but not able to find something as such ///
"Peter Bromberg [C# MVP]" wrote:
> This article is a bit old, but I think it will clearly illustrate an easy
way
> to do this:
> http://www.eggheadcafe.com/articles/20060117.asp
> -- Peter
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> Short Urls & more: http://ittyurl.net
>
> "DavidS" wrote:
>
a postback is really a nav to a new page as far as the browser is concerned.
for security reason a new page can not access the opener of a previous page.
you should abandon the popup page model for this type of application. the
more common approach is to use a floating div to hold your find, and then a
post in find is a post of the page. you can find lots of javascript code
samples for this. the ajx control toolkit has one, so does jQuery.
-- bruce (sqlwork.com)
"DavidS" wrote:
> The article is an excellent one. But I think for my purposes it's limited
in
> what I currently doing.
> 1) The popup I open is required to remain opened after selecting an item
> associated with the search query - the popup from the example uses the Clo
se
> button and than the associated window.opener.update( ret ); to force the
> postback - I believe.
> 2) Issue I'm having is I don't want to close the current window after a po
st
> - hence / simple solution would be to remove the window.close in the
> Page_Load.Done() function - but I believe after a repost, the popup would
> either repost itself in a new window too - hence I used <target =_base> to
> ensure new posts are always the same window. Upon doing this - I believe
> window.opener is now undefined - doesn't point to main form again!
> I can't seem to force the main window to repost - repaint etc... /
> window.opener is undefined after I depress the Submit button on search pag
e -
> since i) it will do SQL query of data; ii) update form with what it's foun
d.
> Is there anyway to have the Handle for the main page - saved - and then us
e
> this handle in the popup I have in some way to force the main window to
> update?
> something like <hwnd of main page>.update() - I can call this from my
> javascript from from the popup - but not able to find something as such //
/
>
> "Peter Bromberg [C# MVP]" wrote:
>
Ok. Makes sense with security issues / I was having very difficult time
doing anything with parent, window.opener, etc...
Concerning jQuery - this is something new to me. I did do google query on
this - lots of places to start. Is there any specific site you can
recommend. Also, is there a location that might have an example too - since
I believe I have to download jQuery and install - etc... and looks like migh
t
take some extra time. Any additional help will cut down on my searches in
wrong direction too.
thanks,
David
"bruce barker" wrote:
> a postback is really a nav to a new page as far as the browser is concerne
d.
> for security reason a new page can not access the opener of a previous pag
e.
> you should abandon the popup page model for this type of application. the
> more common approach is to use a floating div to hold your find, and then
a
> post in find is a post of the page. you can find lots of javascript code
> samples for this. the ajx control toolkit has one, so does jQuery.
> -- bruce (sqlwork.com)
>
> "DavidS" wrote:
>

0 comments:

Post a Comment