Accessing components on other pages

Discussion in 'ASP .Net' started by CJ, Dec 9, 2005.

  1. CJ

    CJ Guest

    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?
     
    CJ, Dec 9, 2005
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    >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?
    >
     
    John Timney \( MVP \), Dec 9, 2005
    #2
    1. Advertising

  3. CJ

    CJ Guest

    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" <> wrote in message
    > news:...
    > >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?
    > >
     
    CJ, Dec 9, 2005
    #3
  4. 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

    "CJ" <> wrote in message
    news:...
    > 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" <> wrote in message
    >> news:...
    >> >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?
    >> >

    >
     
    John Timney \( MVP \), Dec 9, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    3
    Views:
    1,503
    Alvin Bruney
    Dec 2, 2003
  2. Daves
    Replies:
    6
    Views:
    362
    Scott Allen
    Mar 21, 2005
  3. Mickey Segal
    Replies:
    0
    Views:
    916
    Mickey Segal
    Feb 2, 2004
  4. T E Schmitz
    Replies:
    3
    Views:
    427
  5. carmelo
    Replies:
    2
    Views:
    397
    csaffi
    Oct 2, 2009
Loading...

Share This Page