473,499 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a way to do this with Option Strict On?

Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html

Feb 7 '07 #1
8 1169
just an idea why not passing as a Session Variable ?
--

Bruno Alexandre
Strøby, Danmark

"a Portuguese in Denmark"
"Chad Dokmanovich" <ch*************@comcast.netwrote in message
news:wZ******************************@comcast.com. ..
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents that)

http://www.velocityreviews.com/forum...ter-pages.html
Feb 7 '07 #2
An interface should solve your problem and happens to be the correct
approach to tackle such a problem. Without an interface, you're effectvely
tying default2 to default3 - why not detach it from a concrete class and tie
it to a much more flexible interface?

Since you are vague about what "X" is.....
in your app_code,

interface IXContainer
{
string X {get ;}
}

class default3 : Page, IXContainer
{
...
}
dim passedX as string = ctype(Context.Handler, IXcontainer).X
oopps..I wrote 1/2 of that in C#....anyways, you get the idea...I think it
should work the way you want it to.

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"Chad Dokmanovich" <ch*************@comcast.netwrote in message
news:wZ******************************@comcast.com. ..
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents that)

http://www.velocityreviews.com/forum...ter-pages.html
Feb 7 '07 #3

Peter's post about using query string or HttpContext.Current.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 01:40:46 -0500, "Chad Dokmanovich"
<ch*************@comcast.netwrote:
>Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html

Feb 7 '07 #4
Have you tried using the new PreviousPage property? e.g.,

protected void Page_Load(object sender, EventArgs e)

{

if (PreviousPage != null)

{

TextBox textBox = PreviousPage.FindControl("Parameter")

as TextBox;

if (textBox != null)

{

string parameter = textBox.Text;

Parameter.Text = parameter;

}

}

}

--Peter

Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Chad Dokmanovich" wrote:
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html

Feb 7 '07 #5
Interesting point of view, my perspective was the exact opposite: that
passing values from one form to another using strongly type full-blown
properties (which themseleves could have code in the Get routine) is much
more elegant and preferable method to passing string data via hidden forms
fields or even the Session object, which often ends up being a dumping
ground for all of the pages in the app.

I want to be able to defined a property on the source web page that returns
an object that contains all of the property values that are passed from the
source form to the dest form and to do so in a strongly typed "Parameter
class" that is specific to the two forms in question only.

"Samuel R. Neff" <sa********@nomail.comwrote in message
news:bj********************************@4ax.com...
>
Peter's post about using query string or HttpContext.Current.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam

------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 01:40:46 -0500, "Chad Dokmanovich"
<ch*************@comcast.netwrote:
>>Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html


Feb 7 '07 #6

Web forms are not designed for passing strongly typed data to each
other and certainly are not meant for one web form to call properties
in another form. HTTP pages have two well defined ways of passing
data--query string and form variables.

If the data you're passing is more complex than a string, then create
a class to contain the data and put that class in the
HttpContext.Curent.Items collection when passing it, and then cast it
on the receiving page back to the typed class.

Using Session is horrible because the data is not inherintly session
related--you're just passing it from one page to another and dumping
it into the Session is overkill and dangerous).

My $0.02.

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 15:11:52 -0500, "Chad"
<ch**************@unisys.comwrote:
>Interesting point of view, my perspective was the exact opposite: that
passing values from one form to another using strongly type full-blown
properties (which themseleves could have code in the Get routine) is much
more elegant and preferable method to passing string data via hidden forms
fields or even the Session object, which often ends up being a dumping
ground for all of the pages in the app.

I want to be able to defined a property on the source web page that returns
an object that contains all of the property values that are passed from the
source form to the dest form and to do so in a strongly typed "Parameter
class" that is specific to the two forms in question only.

"Samuel R. Neff" <sa********@nomail.comwrote in message
news:bj********************************@4ax.com.. .
>>
Peter's post about using query string or HttpContext.Current.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam
Feb 7 '07 #7
Interesting!

The HttpContext suggestion sounds like it is just what I am looking for!

I dont like query strings because I dont want users to have an opportunity
to manipulate the data that is passed between the pages. I could encode it,
which is probably always a good idea, although at the moment I am writing
for a mobile device and am concerned about the query string limit for the
browser running on the mobile device.

For mobile forms, there are no hidden text fields, there is a
HiddenVariables collection, and while I can persist data there while posting
back to the same page, I've had no luch using this collection to pass data
across forms (no data found on the receicing side). Seems like it should be
straight fwd but It doesnt work for me and I can't find much on the subject.
Here's a blurb:

http://safari.oreilly.com/0735615322/IDATX2T

I'm excited about and will now try the HttpContext suggestion....thx!
"Samuel R. Neff" <sa********@nomail.comwrote in message
news:j8********************************@4ax.com...
>
Web forms are not designed for passing strongly typed data to each
other and certainly are not meant for one web form to call properties
in another form. HTTP pages have two well defined ways of passing
data--query string and form variables.

If the data you're passing is more complex than a string, then create
a class to contain the data and put that class in the
HttpContext.Curent.Items collection when passing it, and then cast it
on the receiving page back to the typed class.

Using Session is horrible because the data is not inherintly session
related--you're just passing it from one page to another and dumping
it into the Session is overkill and dangerous).

My $0.02.

Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.

On Wed, 7 Feb 2007 15:11:52 -0500, "Chad"
<ch**************@unisys.comwrote:
>>Interesting point of view, my perspective was the exact opposite: that
passing values from one form to another using strongly type full-blown
properties (which themseleves could have code in the Get routine) is much
more elegant and preferable method to passing string data via hidden forms
fields or even the Session object, which often ends up being a dumping
ground for all of the pages in the app.

I want to be able to defined a property on the source web page that
returns
an object that contains all of the property values that are passed from
the
source form to the dest form and to do so in a strongly typed "Parameter
class" that is specific to the two forms in question only.

"Samuel R. Neff" <sa********@nomail.comwrote in message
news:bj********************************@4ax.com. ..
>>>
Peter's post about using query string or HttpContext.Current.Items is
probably the best advice. Passing data between webforms by relying on
the webforms own properties is pretty ugly, even if it technically
works.

HTH,

Sam

Feb 8 '07 #8

Here is another option:

10/24/2005
Web Session Wrapper for storing and retrieving objects

http://sholliday.spaces.live.com/blog/
If you .Remove it on the second page, then you shouldn't tax the Session
object.


"Chad Dokmanovich" <ch*************@comcast.netwrote in message
news:wZ******************************@comcast.com. ..
Here's an old post of mine that I never found the answer to. I think that
there is a good chance that you will be surprised that you CAN access a
property on a source web form from the dest web form when redirecting. I
just want to be able to do it using late binding (Option strict on
prevents
that)

http://www.velocityreviews.com/forum...ter-pages.html
>


Feb 8 '07 #9

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

Similar topics

3
296
by: droope | last post by:
I have a routine that does a standard comparison that I pass two objects to Private Function ColumnEqual(ByVal A As Object, ByVal B As Object) As Boolea ' Compares two values to determine if...
9
2119
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
13
3234
by: Cor | last post by:
Hi Option Strict gurus, Because of the so much given advises here to use Option Strict I did try to use that. But it gives an error and I don't know how to resolve that. The message is that...
12
2052
by: Doug Hill | last post by:
Please, Microsoft, update Option Explicit Option Strict barks at late binding. We love late binding. So Option Strict flags too many things. Option Explicit is misleading. It allows Dim...
5
2932
by: John | last post by:
Hi I am getting conversion errors in the below code on the lines highlighted in red. Would appreciate any tips on how to fix these errors. Thanks Regards
8
1809
by: Rich | last post by:
Hello, If I leave Option Strict Off I can use the following syntax to read data from a Lotus Notes application (a NotesViewEntry object represents a row of data from a Lotus Notes View - like a...
8
3964
by: Clark Stevens | last post by:
I've always used Option Strict in my code. However, I was wondering if it is really necessary. Coding seems a lot easier when you don't use it, but does it really make a difference? What are the...
3
1596
by: Rich | last post by:
Hello, The following Delegates example works with Option Strict Off, but if I change it to Option Strict On then VB.Net complains about the line dgY = System.Delegate.Combine(dgI, dgA) Is...
30
1820
by: Microsoft News | last post by:
I have a project that was created all with Option Strict OFF. Works great, not a problem with it. But if I turn Option Strict ON then I get a LOT of errors. My question, should I even care...
17
4460
by: David | last post by:
Hi all, I have the following problem: my program works fine, but when I add option strict at the top of the form, the following sub fails with an error that option strict does not allow late...
0
7006
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...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5467
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,...
1
4917
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...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
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...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
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...

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.