473,609 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing data to another aspx in different frame

I have a web page with 2 frames. The left frame is running menu.aspx and the
right frame is running images.aspx. When a selection is made in menu.aspx I
call a method in images.aspx and pass a variable. The intention is that
images.aspx will take the variable and load images into its frame (the right
one) based on the variable passed. What actually happens is the method runs
in the left frame and ruturns the error "Object reference not set to an
instance of a oblect" in the left frame. Nothing happens in the right frame.
The exception is pointing to the line of code located in images.aspx.cs.
How do I make the code in images.aspx.cs affect the frame it is in instead of
the frame it is called from?

Code in menu.aspx.cs:
private void Button1_Click(o bject sender, System.EventArg s e)
{
string tsource = Startup.MainSou rce[ListBox1.Select edIndex].ToString();
string tlongdate = ListBox1.Select edValue.ToStrin g();
TextBox1.Text = tsource; //local to menu.aspx
Images gi = new Images();
gi.GetImages(tl ongdate, tsource);
}

Code in images.aspx.cs:
public void GetImages(strin g LongDate, string Source)
{
Images mn = new Images();
//this text box is on images.aspx
mn.TextBox1.Tex t = LongDate; //here is the error
}

Thanks,
Evan R. Hicks
Nov 19 '05 #1
3 2708
You must understand that menu.aspx and images.aspx do not exist on the
server at the same instance in time, therefore they cannot communicate
directly with each other.
Instead you need to use other techniques, such as client side code and/or
Session state to pass data between the pages.
This is one reason I try to avoid frames with ASP.NET; it's usually too
complex to be worth it.
Instead it's generally a better idea to use User Controls to divide up
logical sections of your pages.

Here's more info:
http://msdn.microsoft.com/library/de...ercontrols.asp
http://msdn.microsoft.com/library/de...ercontrols.asp
http://msdn.microsoft.com/library/de...ebControls.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Evan" <Ev**@discussio ns.microsoft.co m> wrote in message
news:0F******** *************** ***********@mic rosoft.com...
I have a web page with 2 frames. The left frame is running menu.aspx and
the
right frame is running images.aspx. When a selection is made in menu.aspx
I
call a method in images.aspx and pass a variable. The intention is that
images.aspx will take the variable and load images into its frame (the
right
one) based on the variable passed. What actually happens is the method
runs
in the left frame and ruturns the error "Object reference not set to an
instance of a oblect" in the left frame. Nothing happens in the right
frame.
The exception is pointing to the line of code located in images.aspx.cs.
How do I make the code in images.aspx.cs affect the frame it is in instead
of
the frame it is called from?

Code in menu.aspx.cs:
private void Button1_Click(o bject sender, System.EventArg s e)
{
string tsource = Startup.MainSou rce[ListBox1.Select edIndex].ToString();
string tlongdate = ListBox1.Select edValue.ToStrin g();
TextBox1.Text = tsource; //local to menu.aspx
Images gi = new Images();
gi.GetImages(tl ongdate, tsource);
}

Code in images.aspx.cs:
public void GetImages(strin g LongDate, string Source)
{
Images mn = new Images();
//this text box is on images.aspx
mn.TextBox1.Tex t = LongDate; //here is the error
}

Thanks,
Evan R. Hicks

Nov 19 '05 #2
That answers my question about my current behavior. The problem is that I am
converting an existing site to .NET and it uses two asp pages in separate
frames. Is there a way that a button click on menu.aspx can load images.aspx
in another frame? I can pass the data on the url line for the communication
between the pages. I was thinking maybe Response.Redire ct but there is no
option for a target frame.

Thanks,
Evan

"Steve C. Orr [MVP, MCSD]" wrote:
You must understand that menu.aspx and images.aspx do not exist on the
server at the same instance in time, therefore they cannot communicate
directly with each other.
Instead you need to use other techniques, such as client side code and/or
Session state to pass data between the pages.
This is one reason I try to avoid frames with ASP.NET; it's usually too
complex to be worth it.
Instead it's generally a better idea to use User Controls to divide up
logical sections of your pages.

Here's more info:
http://msdn.microsoft.com/library/de...ercontrols.asp
http://msdn.microsoft.com/library/de...ercontrols.asp
http://msdn.microsoft.com/library/de...ebControls.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Evan" <Ev**@discussio ns.microsoft.co m> wrote in message
news:0F******** *************** ***********@mic rosoft.com...
I have a web page with 2 frames. The left frame is running menu.aspx and
the
right frame is running images.aspx. When a selection is made in menu.aspx
I
call a method in images.aspx and pass a variable. The intention is that
images.aspx will take the variable and load images into its frame (the
right
one) based on the variable passed. What actually happens is the method
runs
in the left frame and ruturns the error "Object reference not set to an
instance of a oblect" in the left frame. Nothing happens in the right
frame.
The exception is pointing to the line of code located in images.aspx.cs.
How do I make the code in images.aspx.cs affect the frame it is in instead
of
the frame it is called from?

Code in menu.aspx.cs:
private void Button1_Click(o bject sender, System.EventArg s e)
{
string tsource = Startup.MainSou rce[ListBox1.Select edIndex].ToString();
string tlongdate = ListBox1.Select edValue.ToStrin g();
TextBox1.Text = tsource; //local to menu.aspx
Images gi = new Images();
gi.GetImages(tl ongdate, tsource);
}

Code in images.aspx.cs:
public void GetImages(strin g LongDate, string Source)
{
Images mn = new Images();
//this text box is on images.aspx
mn.TextBox1.Tex t = LongDate; //here is the error
}

Thanks,
Evan R. Hicks


Nov 19 '05 #3
You're on the right track.
You can output a bit of client side javascript to do the trick.
Something like this should get you started:

Response.Write( "<script language=javasc ript>parent.FRA MENAME.location
= 'whatever.aspx? MyParameter=4'</script>")

You could also use the RegisterClientS criptBlock or
RegisterStartup Script functions to do this.
Here's more info on these:

http://msdn.microsoft.com/library/de...BlockTopic.asp
http://msdn.microsoft.com/library/de...riptBlockTopic

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


"Evan" <Ev**@discussio ns.microsoft.co m> wrote in message
news:0F******** *************** ***********@mic rosoft.com...
That answers my question about my current behavior. The problem is that I
am
converting an existing site to .NET and it uses two asp pages in separate
frames. Is there a way that a button click on menu.aspx can load
images.aspx
in another frame? I can pass the data on the url line for the
communication
between the pages. I was thinking maybe Response.Redire ct but there is no
option for a target frame.

Thanks,
Evan

"Steve C. Orr [MVP, MCSD]" wrote:
You must understand that menu.aspx and images.aspx do not exist on the
server at the same instance in time, therefore they cannot communicate
directly with each other.
Instead you need to use other techniques, such as client side code and/or
Session state to pass data between the pages.
This is one reason I try to avoid frames with ASP.NET; it's usually too
complex to be worth it.
Instead it's generally a better idea to use User Controls to divide up
logical sections of your pages.

Here's more info:
http://msdn.microsoft.com/library/de...ercontrols.asp
http://msdn.microsoft.com/library/de...ercontrols.asp
http://msdn.microsoft.com/library/de...ebControls.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Evan" <Ev**@discussio ns.microsoft.co m> wrote in message
news:0F******** *************** ***********@mic rosoft.com...
>I have a web page with 2 frames. The left frame is running menu.aspx
>and
>the
> right frame is running images.aspx. When a selection is made in
> menu.aspx
> I
> call a method in images.aspx and pass a variable. The intention is
> that
> images.aspx will take the variable and load images into its frame (the
> right
> one) based on the variable passed. What actually happens is the method
> runs
> in the left frame and ruturns the error "Object reference not set to an
> instance of a oblect" in the left frame. Nothing happens in the right
> frame.
> The exception is pointing to the line of code located in
> images.aspx.cs.
> How do I make the code in images.aspx.cs affect the frame it is in
> instead
> of
> the frame it is called from?
>
> Code in menu.aspx.cs:
> private void Button1_Click(o bject sender, System.EventArg s e)
> {
> string tsource = Startup.MainSou rce[ListBox1.Select edIndex].ToString();
> string tlongdate = ListBox1.Select edValue.ToStrin g();
> TextBox1.Text = tsource; //local to menu.aspx
> Images gi = new Images();
> gi.GetImages(tl ongdate, tsource);
> }
>
> Code in images.aspx.cs:
> public void GetImages(strin g LongDate, string Source)
> {
> Images mn = new Images();
> //this text box is on images.aspx
> mn.TextBox1.Tex t = LongDate; //here is the error
> }
>
> Thanks,
> Evan R. Hicks


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1372
by: Jim Mitchell | last post by:
I have a login screen that validates username and password returning the ID in a table of the user logging in. I then use server.transfer to split into two screens as shown below. I would like to pass this ID to PAGE1.ASPX and PAGE2.ASPX as shown below without using cookies and without passing the data on the command line. Is there a way to accomplish this task? I know that it can be done form ASPX page to ASPX page, but I do not see...
2
2527
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text, radio, checkbox, and dropdown. When the form Submit button is clicked, I then need the input data either written to another location on the same page, or written to another page (a different frame would be fine)
5
36394
by: Andy | last post by:
Hi Could someone clarify for me the method parameter passing concept? As I understand it, if you pass a variable without the "ref" syntax then it gets passed as a copy. If you pass a variable with the "ref" syntax then it gets passed as a reference to the object and any changes to
2
1638
by: elik | last post by:
i have a frame page with three parts, each parts attached to aspx file, is there any way to transfer data from one frame to another frame in server side? i meen , when the user select some data from listbox in one frame i want to display is selection in a label belong to another aspx page/ thanks
1
1672
by: Russell | last post by:
Hi there, I'm currently creating a .NET Web Application and I have a question about passing values from one screen to another. I previously used Session variables in the code to store these values, however I can no longer use this method because of my current website "Cloaking" the URL. (When site is cloked, the session variables don't seem to work with frames) Anyway, I was wondering if anyone could offer an alternative, I have tried...
4
2345
by: Gibs | last post by:
Hi I have two aspx pages in a frame and in the top page i am creating the controls dynamically and putting in a place holder. I have a hyperlink in this page to populate the data in the bottom aspx page. When the user clicks this hyperlink i need to populate the bottom aspx pagebased on the user imputs. So i need to pass the values from the top aspx page to bottom aspx page. how can i achieve this. Please give some ideas...
14
1607
by: BrendanMcPherson | last post by:
Hello, Im try to do some tricks to help make a "Search Many Sites from One Location". http://www.act.org.au/b_nexus.htm What I have decided to do is this: 1. You can choose which site you wish to visit from the first page, after pressing go it takes you to a frame page.
4
4155
by: moondaddy | last post by:
I have a htm page where I need to pass some data to an aspx page as a means of sending data to the database. I don't need to see the aspx page so I was going to put it in a hidden iframe. This works real good. Since I don't need the aspx page to do any postback, is there a way to pass a parameter to it with out it finishing the round trip back to the htm page? Thanks. -- moondaddy@newsgroup.nospam
1
3106
by: jrayjr | last post by:
Hello everyone, Im running into a problem passing values from ASP to Flash. I've been searching around and trying different things with no luck. The project im working on will use ASP to pull data from Access and SQL and then post the information on series of frames that is timed. The code im am posting is just a test to try and get values passed to Flash. I am using Flash CS3 with actionscript 2.0. Frame 1: success="";...
0
8127
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8067
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8215
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4015
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.