Hello all,
I have a LinkButton with the PostBackUrl set, I also have an OnClick
event set.
For some reason, the OnClick event is only hit the second time I click
the LinkButton. If I remove the PostBackUrl attribute it hits it every
time. Why is that?
Thanks,
Jon 1 5158
Hi Jon,
I believe postbackURL lets the button post to a different page. I am
assuming you want to redirect the user in some way? Instead, set the button's
commandargument property to the URL you want, and then at the end of the
OnClick event, redirect the user to the value of the CommandArgument Property.
You can refer to the code below for this:
protected void LinkButton1_clk (object sender, EventArgs e)
{
if (someVariable == 2)
{
Response.Redire ct(LinkButton1. CommandArgument .ToString());
}
}
Hope this helps.
Regards,
Manish
"Jon" wrote:
Hello all,
I have a LinkButton with the PostBackUrl set, I also have an OnClick
event set.
For some reason, the OnClick event is only hit the second time I click
the LinkButton. If I remove the PostBackUrl attribute it hits it every
time. Why is that?
Thanks,
Jon
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: osh |
last post by:
All,
I am having trouble using the PostBackUrl feature in .NET 2.0. I have
several User Controls that are on a MasterPage. The User Controls
contain the form fields for a basic search on available homes and
properties in a given area. I put these form fields into User Controls
because they will be repeated in different ways throughout the site and
it would be nice to only update the fields from one place to make a
site wide change.
|
by: samuelberthelot |
last post by:
Hello,
I have a column of linkbuttons which are bound to my datasource. To
determine the text of the link button as well as its PostBackUrl, I use
the event RowCommand.
The issue is that I have to click twice on the link button, first time
to trigger RowCommand, and second time to be actually redirected to the
url assigned to PostBackUrl in the previous click.
|
by: sck10 |
last post by:
Hello,
Can you use the PostBackUrl to post to different sites? I have a page
(PostBackURL.aspx' ) on one website (same server) that has a button set to:
PostBackURL="http://zone1.web.com"
When the second page opened, and tried to get a hidden value on the previous
page, I got the following error:
|
by: Chris |
last post by:
Hi,
i created an ImageButton within an ItemTemplate of a datalist (in
shop.aspx). There are two possibilities:
1) when the user is logged and he clicks on an image, he must be
'postbacked' to another file showing that same picture in big size and with
more info..
2) when not logged and clicking on an image, he must be 'postbacked' to the
login page (log.aspx).
|
by: rn5a |
last post by:
A web page has 2 LinkButtons. When the 1st one is clicked, users are
taken to Shop.aspx & when the 2nd one is clicked, users are taken to
another ASPX page named ProcessOrder.aspx.
-----------------------------------
<asp:LinkButton ID="lkbShop" OnClick="BackToShop"
PostBackUrl="Shop.aspx" runat="server"/>
<asp:LinkButton ID="lkbSubmit" PostBackUrl="ProcessOrder.aspx"
Text="SUBMIT ORDER" runat="server"/>
| |
by: noneya22 |
last post by:
I'm using asp.net 2.0. I have a page that has a save button and a
cancel button along with a text field. All controls are asp.net
server controls. I have JavaScript that prompts the user if he has
maninpulated data in the text field and then tries to leave the page.
The purpose is to prevent the user from accidentally losing his
changes. This JavaScript code that accomplishes this is based upon
the code found at...
|
by: Mel |
last post by:
I have a website that allows the user to generate a new quote. When
they are finished creating the quote, it brings them to the final page
(called the Goodbye.aspx page) which just states the quote has been
submitted and an email will arrive to them shortly.
I added a "Home" link button on this page which will return them to
the website's home page. I want to clear out 10 session variables
(contact name, ship to address, city, state,...
|
by: RN1 |
last post by:
An ASPX page, named LinkButton.aspx, has a single LinkButton & nothing
else. The code is very simple:
<form runat="server">
<asp:LinkButton ID="lnk" PostBackUrl="Page1.aspx" Text="CLICK"
runat="server"/>
</form>
When I run the above code in my local; (Intranet) IIS server, then
when the LinkButton is clicked, the user is taken to Page1.aspx but
|
by: Eric |
last post by:
I have a linkbutton on a form that executes a script, it works fine except
that it posts back to the calling form first. Is there a way to prevent
this? I tried setting the PostBackURL property to the form the script
launches but that resulted in some strange behavior.
TIA
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |