473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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
Jun 27 '08 #1
4 4194
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" <mu*******@community.nospamwrote in message
news:1D**********************************@microsof t.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

Jun 27 '08 #2
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" <mu*******@community.nospamwrote in message
news:1D**********************************@microsof t.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


Jun 27 '08 #3
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" <mu*******@community.nospamwrote in message
news:B8**********************************@microsof t.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" <mu*******@community.nospamwrote in message
news:1D**********************************@microso ft.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



Jun 27 '08 #4
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
Jun 27 '08 #5

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

Similar topics

3
by: dave | last post by:
I have half a dozen web form radio buttons on a web form. Each of them is set to postback=true. However, if for instance radiobutton1 is already selected and the user selects it again, it performs...
4
by: Martin | last post by:
I know this might seem like an odd question. I've got a page that has a few url parameters. There's a couple of modes the page can be entered in, with correspondingly different urls params. ...
6
by: ruca | last post by:
Hi gurus, I have a imagebutton in my WebForm, and I want that when I click (mouse down) on her the imagebutton change image and when I "unclick" (mouse up) change to the original image. Basically...
2
by: rodchar | last post by:
Hey all, I have an asp.net page called default.aspx. when I visit this site i type in http://myDirectory/ because I know that the name default.aspx will be assumed. However, when i goto this...
9
by: ad | last post by:
Hi, How can I dynamically change the MasterPager of a web page?
4
by: Dst | last post by:
This is what i'm trying to do: I'm porting a windows app to a web app. I have a webform which will edit some data stored in a database. The data needs to be locked in the database, while editing....
0
by: Merdaad | last post by:
I know that if I change the text on a textBox it would trigger the textBoxChange event hadler. But how about if you don't want to change anything on the textbox and just want to focus on it and...
1
by: seanwalsh | last post by:
Hi I have a footer row in a gridview that allows inserting of records into a table. One of the controls is a DropDownList control. I want this control to default to the value in the QueryString....
3
by: crjunk | last post by:
Hi Everyone, I have a web form that I would like to enhance. What I'd like to do is this: A user adds/edits the text in a textbox. I want the adjoining label to change color. Example: User...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.