Accessing components on other pages

C

CJ

I have a page with a bunch of iframes (which make up a tab control).
At least one of these iframes contains an aspx page, which in turn
contains a .ascx component. This component then contains a datagrid.

Is there any way that I can access this datagrid from one of the other
iframes? The grid contains a template column containing checkboxes, and
I need to access the rows for which the checkbox is selected from this
other iframe. Since it's a templatecolumn, I can't just put the
underlying dataset in the session state and retrieve it from the other
page; I *could* maintain a second dataset containing just the selected
rows, which I update whenever a checkbox's state changes, but that just
seems incredibly slow and clumsy.

Is there any way I can do this?
 
J

John Timney \( MVP \)

You can talk between pages and compontents using javascript at the client
side, as long as you dont subject the browser to a cross site scripting
attack which is what normally happens when communciating between iframes.
Theres a good example of talking to an iframe from within a page here that
should get you started.

http://www.dyn-web.com/dhtml/iframes/

You cant talk to a iframes content if its not from the same domain, only to
the iframe object.

See:
http://msdn.microsoft.com/workshop/author/om/xframe_scripting_security.asp

iFrames are a pain to work with, you might be better off using divs.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
C

CJ

The page I want to access the grid from is also an asp.net page, so it
doesn't have to be clientside access; in fact, it *shouldn't* be
because I need to pass the selected items from the grid to another .net
method running on the server. So I guess the question is, from within
an asp.net page, can I access a datagrid in an asp.net custom control
on a different asp.net page, which sits within an iframe within a third
asp.net page?

Put like that, it sounds rather hopeless.

I know that iframes are a pain to work with; unfortunately it's a
project that I've inherited so I don't have much choice. Thanks for
the links, they might not help to solve this problem but they should
help me understand iframes better!
 
J

John Timney \( MVP \)

This is very hard to do server side, as you have to capture the output of
any page before its rendered and delivered - in order of execution.

Have a read of Riks blog for an example of capturing page output and see eif
you can work out a way of making the server side access work.
http://west-wind.com/weblog/posts/481.aspx

The difficulty will probably be in ensuring the pipeline renders the pages
in the correct order.



John Timney
ASP.NET MVP
Microsoft Regional Director
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top