|
-
May 3rd, 2008, 05:04 AM
#1
Thread Starter
Junior Member
[RESOLVED] LinkButton does not perform assigned code
Hi!
I have LinkButton object, which I need to load another page after been pressed. At the same time, there is a code assigned to it. Let's say, assigning a value to a variable.
The funny thing is that when there is no URL yet assigned in Properties (PostBackUrl), then code is working fine. But as soon as I put there some link, button only work for this link, no code processed!
Any ideas on this tricky one? How to force it to simultaneously assign value to a variable and then move to another page?
Last edited by FreakyBoy; May 4th, 2008 at 04:59 PM.
-
May 3rd, 2008, 05:11 AM
#2
Re: LinkButton does not perform assigned code
You should post your ASP.NET questions in the ASP.NET forum.
The PostBackUrl is the page you want to post your data back to when the link is clicked. It sounds to me like you don't want to post back to a different page. You probably want to post back to the same page, so don't set the PostBackUrl. If you want the Click event of the LinkButton to be handled in the same page then you certainly do want to post back to the same page. You can then redirect to a new page from that event handler.
-
May 3rd, 2008, 02:33 PM
#3
Re: LinkButton does not perform assigned code
In the LinkButton's click event handler, do your processing, then Response.Redirect.
-
May 4th, 2008, 04:58 PM
#4
Thread Starter
Junior Member
Re: LinkButton does not perform assigned code
Great! No need to use this LinkButton!
Thanx!
-
May 4th, 2008, 05:44 PM
#5
Re: [RESOLVED] LinkButton does not perform assigned code
The point of a LinkButton is to look like a HyperLink and behave like a Button. If that's what you want then a LinkButton is exactly what you should use, otherwise not.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|