repost w/ corrected MSDN name, simple frame to frame aspx communic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 frames - one with button and another with a grid
How do I get a reference to the controls on the other webform ?

From the one frame I can 'see the webform' fo the other frame, bit not the controls.
A simple code snippet would help. MSDN subscriber - but I dont think its linking correctly.

Thanks --
Andrew
 
Hi Andrew,

From your description, you have two frame pages and want to reference the
controls on one page from another page, yes?

As for the problem, here are some of my suggestions:

1. The ASP.NET web page is using the Webform mode which contains many
ASP.NET Servercontrols. However, the webform and all its containing
servercontrols are only avaliable at the serverside( when the web page's
request is processing). So we can't access the serverside control
collection of one page from another page.

2. However, the ASP.NET web page will be rendered out as a html page to
client and the asp.net server controls are rendered as html elements. For
example, the ASP.NET TextBox control is rendered as <input type="text"...>
Label control is rendered as <span>....</span>....
But their "Id" attributre will still remain the same with their server
control's id so that when post back they could still restore the mapping.

Then, since the #1 and #2 I mentioned, the only means we can access the
controls on one page from another( frame based pages) is to use clientside
script and get the html element(rather than server control) via its "id".

For example, if we have two frames called
frmLeft and frmRight

in frmLeft ,there is a button and in frmRight there is a TextBox (actually
is <input type="text" ...>) and id is "txtRight",

Then, in frmLeft, we can use the following script code to get the reference
to the "txtMain"

window.parent.frames["frmRight"].document.getElementById("txtMain");

In addition, here are some former threads in the group discussing on the
similiar problem:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=LS81FxbzDHA.2900%
40cpmsftngxa07.phx.gbl&rnum=3&prev=/groups%3Fq%3Dframes%2Bsteven%2Bcheng%26i
e%3DUTF-8%26hl%3Den

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=od7ExTTyDHA.2604%
40cpmsftngxa07.phx.gbl&rnum=4&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26
q%3Dframe%2Bpage%2Bsteven%2Bcheng

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Hi Andrew,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 
Back
Top