Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Change default postback url (.net 3.5) (http://www.velocityreviews.com/forums/t621768-change-default-postback-url-net-3-5-a.html)

musosdev 06-23-2008 09:22 AM

Change default postback url (.net 3.5)
 
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* :o)

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

Eliyahu Goldin 06-23-2008 10:04 AM

Re: Change default postback url (.net 3.5)
 
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" <musoswire@community.nospam> wrote in message
news:1D36CC02-46C8-498D-9968-9C2940E6AC6B@microsoft.com...
> 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* :o)
>
> 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




musosdev 06-23-2008 11:39 AM

Re: Change default postback url (.net 3.5)
 
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" <musoswire@community.nospam> wrote in message
> news:1D36CC02-46C8-498D-9968-9C2940E6AC6B@microsoft.com...
> > 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* :o)
> >
> > 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

>
>
>


Eliyahu Goldin 06-23-2008 01:37 PM

Re: Change default postback url (.net 3.5)
 
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" <musoswire@community.nospam> wrote in message
news:B88B89FF-815E-4C70-9905-D89BD06B81CD@microsoft.com...
> 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" <musoswire@community.nospam> wrote in message
>> news:1D36CC02-46C8-498D-9968-9C2940E6AC6B@microsoft.com...
>> > 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* :o)
>> >
>> > 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

>>
>>
>>




bruce barker 06-23-2008 03:31 PM

RE: Change default postback url (.net 3.5)
 
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* :o)
>
> 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



All times are GMT. The time now is 06:02 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57