Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Change default postback url (.net 3.5)

Reply
Thread Tools

Change default postback url (.net 3.5)

 
 
musosdev
Guest
Posts: n/a
 
      06-23-2008
Hi peeps

I'm trying to change the default postback of my webpage. I'm trying to
create a searchbox where you can just press enter and it goes to the search
results (ala apple.com *ahem* )

However, the page just postsback to itself when I hit enter.

Is there any way to change the default postback behaviour for a page?! I'm
using .net 3.5

Thanks,


Dan
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-23-2008
Button.PostBackUrl will do. You can also do it on server side with a
Server.Transfer call. Or you can do it on client side with a javascript call
window.navigate(url).

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"musosdev" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi peeps
>
> I'm trying to change the default postback of my webpage. I'm trying to
> create a searchbox where you can just press enter and it goes to the
> search
> results (ala apple.com *ahem* )
>
> However, the page just postsback to itself when I hit enter.
>
> Is there any way to change the default postback behaviour for a page?! I'm
> using .net 3.5
>
> Thanks,
>
>
> Dan



 
Reply With Quote
 
 
 
 
musosdev
Guest
Posts: n/a
 
      06-23-2008
Eliyahu,

None of those solutions would work without either a button or a postback to
the original page and then a forward (server.transfer, etc) - am I correct?

I've actually managed to solve it by adding my header *outside* of the form
tag on my master page, and creating a standard html form with an action=""
property.

Works a treat, although I'm sure someone will tell me why it's a bad idea



"Eliyahu Goldin" wrote:

> Button.PostBackUrl will do. You can also do it on server side with a
> Server.Transfer call. Or you can do it on client side with a javascript call
> window.navigate(url).
>
> --
> Eliyahu Goldin,
> Software Developer
> Microsoft MVP [ASP.NET]
> http://msmvps.com/blogs/egoldin
> http://usableasp.net
>
>
> "musosdev" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi peeps
> >
> > I'm trying to change the default postback of my webpage. I'm trying to
> > create a searchbox where you can just press enter and it goes to the
> > search
> > results (ala apple.com *ahem* )
> >
> > However, the page just postsback to itself when I hit enter.
> >
> > Is there any way to change the default postback behaviour for a page?! I'm
> > using .net 3.5
> >
> > Thanks,
> >
> >
> > Dan

>
>
>

 
Reply With Quote
 
Eliyahu Goldin
Guest
Posts: n/a
 
      06-23-2008
Only Server.Transfer postbacks to the original page. Button.PostBackUrl and
window.navigate(url) don't.

You solution takes the header out of asp.net. Not sure what do you gain by
this comparing with just setting PostBackUrl.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"musosdev" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Eliyahu,
>
> None of those solutions would work without either a button or a postback
> to
> the original page and then a forward (server.transfer, etc) - am I
> correct?
>
> I've actually managed to solve it by adding my header *outside* of the
> form
> tag on my master page, and creating a standard html form with an action=""
> property.
>
> Works a treat, although I'm sure someone will tell me why it's a bad idea
>
>
>
>
> "Eliyahu Goldin" wrote:
>
>> Button.PostBackUrl will do. You can also do it on server side with a
>> Server.Transfer call. Or you can do it on client side with a javascript
>> call
>> window.navigate(url).
>>
>> --
>> Eliyahu Goldin,
>> Software Developer
>> Microsoft MVP [ASP.NET]
>> http://msmvps.com/blogs/egoldin
>> http://usableasp.net
>>
>>
>> "musosdev" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hi peeps
>> >
>> > I'm trying to change the default postback of my webpage. I'm trying to
>> > create a searchbox where you can just press enter and it goes to the
>> > search
>> > results (ala apple.com *ahem* )
>> >
>> > However, the page just postsback to itself when I hit enter.
>> >
>> > Is there any way to change the default postback behaviour for a page?!
>> > I'm
>> > using .net 3.5
>> >
>> > Thanks,
>> >
>> >
>> > Dan

>>
>>
>>



 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      06-23-2008
not with a webform. as you found out, setting the postbackurl, just adds
javascript to the button. you have two options

1) the approach you found, do not put a runat=server on the form.

2) switch to the new MVC handler instead of using webforms. this gets around
all the limitations of web forms and is probably better suited to someone who
knows web technologies. if you want to go in an ajax direction, then I'd
really recommend the switch. the main downside is that MVC is still in beta.


-- bruce (sqlwork.com)


"musosdev" wrote:

> Hi peeps
>
> I'm trying to change the default postback of my webpage. I'm trying to
> create a searchbox where you can just press enter and it goes to the search
> results (ala apple.com *ahem* )
>
> However, the page just postsback to itself when I hit enter.
>
> Is there any way to change the default postback behaviour for a page?! I'm
> using .net 3.5
>
> Thanks,
>
>
> Dan

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A Paradise DNS address change? What change? There was no change. Tony Neville NZ Computing 7 09-22-2006 01:02 PM
effecting postback without auto postback controls Psych971 ASP .Net 5 12-17-2004 08:53 PM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
reroute to another url, but the first url must shouldnt change in theadress-mask guenther schoebel HTML 2 10-10-2003 07:44 AM



Advertisments