Posting to another page attribute: PostTargetUrl

A

anon

Post Forwarding question......

For this control below,

<asp:Button runat="server" PostTargetUrl="page2.aspx" />

The Attribute: PostTargetUrl="page2.aspx"

Is this PostTargetUrl Attribute going to be available in the <a> and Html
Controls as well as opposed to just the <asp:Button> control?

Lots of other controls, HTML controls, <a>, <img>, etc, would like to used
to post forward....
 
S

Steve C. Orr [MVP, MCSD]

Setting the form action attribute just isn't the ASP.NET way.

Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx

http://www.aspalliance.com/kenc/passval.aspx

http://www.dotnetjunkies.com/tutorials.aspx?tutorialid=600

http://www.dotnetbips.com/displayarticle.aspx?id=79

Here's one nice, simple way to pass values from one page to another:

'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")

Then, in WebForm2.aspx:

'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
 
A

anon

Yes, but setting the form action attribute is the BEST way to pass
information page to page.

<asp:Button runat="server" PostTargetUrl="page2.aspx" />
The Attribute: PostTargetUrl="page2.aspx"

It's fastest way and most simpliest way for form data next to like the
querystring.
It's definately K.I.S.S. type of architecture.
It's got the best performance on an enterprise level or any level for that
matter
And it works, plain and simple.

All of those other ways are messy hacks that have drawbacks one way or
another and can makes your code far far more complicated than what it should
be.

All the other languages can do it this way, except .NET and because of that,
it's a pain in the a** to get real life questionairre form data into a
database.

The fact that MS is addressing this issue head on is a testament to this
major major screwup

Now, let's get back to the ORIGINAL question... is PostTargetUrl going to be
in the other HTML controls? That's what's important here and let's not SCREW
it up like MS did with 1.0 and 1.1
 
R

Rocky Moore

I have to disagree with you. Processing forms is a simple matter now with
..NET and you no longer for to push people to another page just to save off
the data. That is something I would consider more of a hack.

In .NET it is a simple matter to respond to the OnClick event, which your
validators will have validated the form and you are ready to process that
data from simple server controls and store in the database. If any errors
occur you have not left he page yet and can update a status field on the
form informing them of the error while all their data is preserved. Once
the data is successfully stored, you simply do a transfer to send them to a
result page if you so desire or back to the main page.

It really does not get much easier than this. And the process keeps all
your server controls hooked for easy processing not to mention keeping your
code clean only having to deal with a single page. The processing of
regular form data has been a pain in the tush for over a decade!
 
A

anon

This where you are really clueless in the real world.

First, if you have a decent size form page and your post right back to the
same page, the user can't find where the mistake is; especially is every
other things is marked in red, *required

Forms that are challenging also span several pages long....if you have a
single page, that's a complete nightmare anyway you look at it.

Second, IIS logging tells a lot without having to do this at a
database...doing it your way is a perfomance hit.

Third, the validation controls are pointless, they are not practically in
the real world...maybe a simple for like signing up for a Hotmail account is
good for you. But that form asks your for hardly any important information
anyway.

Fourth, if you have any important information to be inserted into a database
it still has to validated service side anyway.

It pays to have a separate validation page that can be a lot more
intelligent to tell the users what's wrong and also on the server to
initialize more validation routines for security hacks and more help for the
user.

I can go on and on, but I don't....almost ALL .NET top notch guru authors
developers SUCK at web development anyway......they have poor user interface
skills and can't communicate to the common user if their life depended upon
it....look at the failure of adoption of ASP.NET in the real world...Mr.
Gates said it himself..".NET is slow going" and took 3 years to get to this
point to have a decent list of .NET examples.

The fact that Microsoft's ASP.NET 2.0 is directly addressing this need to
post to another page shows you how clueless you are to REAL life business
web application and I am glad they, Microsoft, isn't listening to you or the
MVP's, .NET authors and the like, who PREACHED over and over again the the
complete stupidity of Postback. Now, they have to eat HUMBLE PIE.....
 
E

Eric Newton

Personally, I agree with you.

There are times where I designed asp forms that posted back to themselves,
just like Asp.net where they'd detect IsPostBack and process form variables
accordingly.

However, there is always the OTHER way, whereas you collect information and
pass that info on to ANOTHER form for processing... SEARCHING comes to
mind...

For example, when you want to search based on Mfr Part Number, you'd submit
search parameters to a form that specialized in displaying and sorting via
MANUFACTURERS, another scenario would be to search by Stocks, stock symbol
vs company name... the form "posted" to would specialize on helping you find
either the stock SYMBOL you're looking for, or a company name, and THEN the
stock symbol, which probably would post back to an original "quote display"
form that specialized only in displaying quotes.

the asp.net postback mentality has been both nice AND problematic

so I agree with "anon" in that it was a screwup only to force EVERYBODY to
run through a "new" model, and ONLY that "new" model


--
Eric Newton
eric.at.ensoft-software.com
www.ensoft-software.com
C#/ASP.net Solutions developer
 
G

George Ter-Saakov

Nobody forces you to specify runat server for any form or control.

So for anything like "search" functionality i am using exactly the same way
as i would use in ASP.

<form target="searchresult.aspx"><input type="text" name="word"></form>

And i do not have any problem.

And i can not aggree with you that ASP.NET forces to anyhting.

You can always use ASP model (without post backs) with ASP.NET exaclty the
same way as you would with ASP.

George.
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top