Home All Groups Group Topic Archive Search About

Accessing components on other pages

Author
9 Dec 2005 1:55 PM
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?

Author
9 Dec 2005 2:04 PM
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

Show quote
"CJ" <cj_t***@mail.com> wrote in message
news:1134136515.342437.217960@o13g2000cwo.googlegroups.com...
>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?
>
Author
9 Dec 2005 2:17 PM
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!

John Timney ( MVP ) wrote:
Show quote
> 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
>
> "CJ" <cj_t***@mail.com> wrote in message
> news:1134136515.342437.217960@o13g2000cwo.googlegroups.com...
> >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?
> >
Author
9 Dec 2005 3:20 PM
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

Show quote
"CJ" <cj_t***@mail.com> wrote in message
news:1134137854.595781.90520@f14g2000cwb.googlegroups.com...
> 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!
>
> John Timney ( MVP ) wrote:
>> 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
>>
>> "CJ" <cj_t***@mail.com> wrote in message
>> news:1134136515.342437.217960@o13g2000cwo.googlegroups.com...
>> >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?
>> >
>

AddThis Social Bookmark Button