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(object sender, System.EventArgs e)
{
string tsource = Startup.MainSource[ListBox1.SelectedIndex].ToString();
string tlongdate = ListBox1.SelectedValue.ToString();
TextBox1.Text = tsource; //local to menu.aspx
Images gi = new Images();
gi.GetImages(tlongdate, tsource);
}
Code in images.aspx.cs:
public void GetImages(string LongDate, string Source)
{
Images mn = new Images();
//this text box is on images.aspx
mn.TextBox1.Text = LongDate; //here is the error
}
Thanks,
Evan R. Hicks 3 2702
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**@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.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(object sender, System.EventArgs e) { string tsource = Startup.MainSource[ListBox1.SelectedIndex].ToString(); string tlongdate = ListBox1.SelectedValue.ToString(); TextBox1.Text = tsource; //local to menu.aspx Images gi = new Images(); gi.GetImages(tlongdate, tsource); }
Code in images.aspx.cs: public void GetImages(string LongDate, string Source) { Images mn = new Images(); //this text box is on images.aspx mn.TextBox1.Text = LongDate; //here is the error }
Thanks, Evan R. Hicks
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.Redirect 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**@discussions.microsoft.com> wrote in message news:0F**********************************@microsof t.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(object sender, System.EventArgs e) { string tsource = Startup.MainSource[ListBox1.SelectedIndex].ToString(); string tlongdate = ListBox1.SelectedValue.ToString(); TextBox1.Text = tsource; //local to menu.aspx Images gi = new Images(); gi.GetImages(tlongdate, tsource); }
Code in images.aspx.cs: public void GetImages(string LongDate, string Source) { Images mn = new Images(); //this text box is on images.aspx mn.TextBox1.Text = LongDate; //here is the error }
Thanks, Evan R. Hicks
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=javascript>parent.FRAMENAME.location
= 'whatever.aspx?MyParameter=4'</script>")
You could also use the RegisterClientScriptBlock or
RegisterStartupScript 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**@discussions.microsoft.com> wrote in message
news:0F**********************************@microsof t.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.Redirect 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**@discussions.microsoft.com> wrote in message news:0F**********************************@microsof t.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(object sender, System.EventArgs e) > { > string tsource = Startup.MainSource[ListBox1.SelectedIndex].ToString(); > string tlongdate = ListBox1.SelectedValue.ToString(); > TextBox1.Text = tsource; //local to menu.aspx > Images gi = new Images(); > gi.GetImages(tlongdate, tsource); > } > > Code in images.aspx.cs: > public void GetImages(string LongDate, string Source) > { > Images mn = new Images(); > //this text box is on images.aspx > mn.TextBox1.Text = LongDate; //here is the error > } > > Thanks, > Evan R. Hicks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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,...
|
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...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |