• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

referencing frames in ASP.NET

Hi,
  I have a main HTML page that has a frameset. Two frames are inside this and they references top.aspx and botton.aspx. The ids of the frames are top and bottom respectively.The top.aspx has a textbox that user enters a name into. I want the value to appear in the bottom.aspx.  (The id of the form in the bottom.aspx is 'formbottom'.)

I am currently doing the following in a textonchange sub in the top.aspx but getting the error:
BC30203: Identifier expected.

 parent."bottom".formbottom.textName.text=Tb1.text.ToString()

ANy clues?

thanx

0
LuckyLucks
Asked:
LuckyLucks
  • 5
  • 4
1 Solution
 
hismightinessCommented:
You're going to have to accomplish this with JavaScript, not .Net.  The only way to do this with .Net is by not using frames, but User Controls.  You can do this quite easily this way by having the respective page classes contain Public Shared Properties to assign your values.
0
 
LuckyLucksAuthor Commented:
But then can a javascript reference aspx page objects. For instance,how will it reference a textbox in a form-parent.document.formname.textbox.text?

0
 
hismightinessCommented:
JavaScript can reference .Net objects just fine.  The only ones that are difficult to reference are those which are embedded in other objects, like DataGrids or Repeaters.  Normally, all you have to do is use the same name you assign to its ID property (this may vary with UserControls too, but you need to try it to find out).  However, this can require you to name your form.  
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LuckyLucksAuthor Commented:
OK, I created a shared class with get and set properties to access the shared text variable. Will this be a .vb file or an .aspx file. And how would I include or access this file from the aspx page that needs to retreive this shared variable.(i.e syntax of the import or something).
0
 
hismightinessCommented:
You don't need to create a new class unless you really want to.  

If y ou are wanting to go the UserControl route, then just copy and paste the HTML content from each framed page into its own UserControl (*.ascx file).  Then you can drag and drop it onto the main page, or programmatically add it when needed.  Now, within each UserControl that has an object you wish to make changes to from another UserControl, you want to make that control Public instead of Protected.  This should allow you to reference it just like any other control, but you may have to prefix the controls name with the name of the UserControl class.

Example:
UserControl1.DropDownList1.SelectedIndex = 1
0
 
LuckyLucksAuthor Commented:
I am using asp controls. How would I make them public or protected?
0
 
hismightinessCommented:
In your CodeBehind, you will see them declared near the top of the page.  The line will say something like:

Protected WithEvents myControl As System.Web.UI.WebControls.MyControl

Change it to:

Public WithEvents myControl As System.Web.UI.WebControls.MyControl
0
 
LuckyLucksAuthor Commented:
I am not using code behind but rather inline. Is there a way I can accomplish that w/o rewriting everything in a code behind? And if not, I would sincerely appreciate the classes to import that go at the top of the code behind page. Also a example link if you already know of a good one would help but this I can hunt for myself too.

Thanx
0
 
hismightinessCommented:
I don't know a whole lot about inline coding.  Do you at any point have to Dim your WebControls in inline coding?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now