Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

LinkButton PostBackUrl

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon - 27 Sep 2007 17:21 GMT
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
Manish - 28 Sep 2007 08:04 GMT
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.Redirect(LinkButton1.CommandArgument.ToString());
           }
       }

Hope this helps.

Regards,
Manish

> Hello all,
>
[quoted text clipped - 8 lines]
>
> Jon

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.