Create an instance of one webform on another webform

P

Paul

Hi I have start web form and when the user clicks a button (server.transfer)
they are directed to the second webform. I was wondering if there is a way
to create an instance of the first webform on the second webform? I have a
base webform class that both webforms inherit
webform1 : BaseWebclass
webform2 :BaseWebclass

so I do not think I can just inherit webform1 in webform2
thanks
 
M

Michael Nemtsev [MVP]

Hello Paul,

What's your requirements? What exactly do u want to get?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


P> Hi I have start web form and when the user clicks a button
P> (server.transfer)
P> they are directed to the second webform. I was wondering if there is
P> a way
P> to create an instance of the first webform on the second webform? I
P> have a
P> base webform class that both webforms inherit
P> webform1 : BaseWebclass
P> webform2 :BaseWebclass
P> so I do not think I can just inherit webform1 in webform2 thanks
P>
 
P

Paul

Hi thanks for the response. I was trying to pass values from one webform to
another and found a method of setting properties on the source webform and
using server.transfer and using the properties on the destination webform to
get the values. This requires creating an instance of the source webform on
the destination webform. I ended up just using the query string where the
parameters are in the URL. Many of the pages inherit from a masterpage class
so probably can not just inherit the source page objects into the destination
page.
 
M

Michael Nemtsev [MVP]

Hello Paul,

You need to use Crosspage postback feature of asp.net 2.0 http://msdn.microsoft.com/en-us/library/ms178139.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


P> Hi thanks for the response. I was trying to pass values from one
P> webform to another and found a method of setting properties on the
P> source webform and using server.transfer and using the properties on
P> the destination webform to get the values. This requires creating an
P> instance of the source webform on the destination webform. I ended
P> up just using the query string where the parameters are in the URL.
P> Many of the pages inherit from a masterpage class so probably can not
P> just inherit the source page objects into the destination page.
P>
P> "Michael Nemtsev [MVP]" wrote:
P>
Hello Paul,

What's your requirements? What exactly do u want to get?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

P> Hi I have start web form and when the user clicks a button
P> (server.transfer)
P> they are directed to the second webform. I was wondering if there
is
P> a way
P> to create an instance of the first webform on the second webform?
I
P> have a
P> base webform class that both webforms inherit
P> webform1 : BaseWebclass
P> webform2 :BaseWebclass
P> so I do not think I can just inherit webform1 in webform2 thanks
P>
 
P

Paul

thanks will give it a try. The post back (to the new page) is conditional
but this should not cause any complications.
--
Paul G
Software engineer.


Michael Nemtsev said:
Hello Paul,

You need to use Crosspage postback feature of asp.net 2.0 http://msdn.microsoft.com/en-us/library/ms178139.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


P> Hi thanks for the response. I was trying to pass values from one
P> webform to another and found a method of setting properties on the
P> source webform and using server.transfer and using the properties on
P> the destination webform to get the values. This requires creating an
P> instance of the source webform on the destination webform. I ended
P> up just using the query string where the parameters are in the URL.
P> Many of the pages inherit from a masterpage class so probably can not
P> just inherit the source page objects into the destination page.
P>
P> "Michael Nemtsev [MVP]" wrote:
P>
Hello Paul,

What's your requirements? What exactly do u want to get?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

P> Hi I have start web form and when the user clicks a button
P> (server.transfer)
P> they are directed to the second webform. I was wondering if there
is
P> a way
P> to create an instance of the first webform on the second webform?
I
P> have a
P> base webform class that both webforms inherit
P> webform1 : BaseWebclass
P> webform2 :BaseWebclass
P> so I do not think I can just inherit webform1 in webform2 thanks
P>
 
P

Paul

thanks for the information, was able to get it to work. Still have one minor
problem as I have a dropdown list and button on the source page and only want
selecting the button to post to the new page if the dropdown list box on the
source page selected index is not set to 0. I am thinking a custom validator
for the button with the selected control being the dropdown list box may work
but not sure what to use for the client side script.
--
Paul G
Software engineer.


Michael Nemtsev said:
Hello Paul,

You need to use Crosspage postback feature of asp.net 2.0 http://msdn.microsoft.com/en-us/library/ms178139.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


P> Hi thanks for the response. I was trying to pass values from one
P> webform to another and found a method of setting properties on the
P> source webform and using server.transfer and using the properties on
P> the destination webform to get the values. This requires creating an
P> instance of the source webform on the destination webform. I ended
P> up just using the query string where the parameters are in the URL.
P> Many of the pages inherit from a masterpage class so probably can not
P> just inherit the source page objects into the destination page.
P>
P> "Michael Nemtsev [MVP]" wrote:
P>
Hello Paul,

What's your requirements? What exactly do u want to get?

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high
and we miss it, but that it is too low and we reach it" (c)
Michelangelo

P> Hi I have start web form and when the user clicks a button
P> (server.transfer)
P> they are directed to the second webform. I was wondering if there
is
P> a way
P> to create an instance of the first webform on the second webform?
I
P> have a
P> base webform class that both webforms inherit
P> webform1 : BaseWebclass
P> webform2 :BaseWebclass
P> so I do not think I can just inherit webform1 in webform2 thanks
P>
 
Joined
Nov 26, 2009
Messages
1
Reaction score
0
but problem hasnt resolved yet....

Hello there,

Paulo I think we had same problem before you solve it...Now my problem is existing that's why i m writing to you.How did you resolved the problem coz i had a look the msdn samples which are posted but i couldnt achieved...I m not familiar to web programming or asp.net but i need to resolve it.

At first i need to understand how we can get the value from the first page' textbox in the code which is below

if (Page.PreviousPage != null)
{
TextBox SourceTextBox = ?????why textbox????
(TextBox)?????Why textboxPage.PreviousPage.FindControl("TextBox1");
if (SourceTextBox != null)
{
Label1.Text = SourceTextBox.Text;
}
}


Besides,The target page code is a little bit weird for me....Sorry about complain but i need to complete this project...

Thanks for your help i m looking forward to hear from you.....
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top