Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 18th, 2007, 08:56 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: norcross, Ga, USA.
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default Link button click event

Hi friends

How can i check whether a link button is clicked or not?
I want to perform some validations, if a link button is clicked
But confused how to check whether it have been clicked or not

Can anyone please help me in this?
Thanks

  #2 (permalink)  
Old May 18th, 2007, 09:07 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Depends, are you looking for server side validation or client side valdiation when the click event is triggered?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #3 (permalink)  
Old May 18th, 2007, 09:09 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: norcross, Ga, USA.
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Server side only

Thank you

  #4 (permalink)  
Old May 18th, 2007, 09:11 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Handle it's click event like any other button then.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
  #5 (permalink)  
Old May 18th, 2007, 09:16 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: norcross, Ga, USA.
Posts: 107
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can i do something like this
if linkbutton1.clicked = true then
count = 1
else
count = 0
end if

Thanks

  #6 (permalink)  
Old May 18th, 2007, 09:29 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This type of logic seems better suited for a client side script, but in any case, you can not use that logic on the backend.

The rasing of the click event method signifies that the button was clicked so your logic would be redundant inside of a click event handler as (even if there was a clicked property) it would always return true.

If, however, your intent is to use one event handler for multiple buttons you would do something like this to determine which button raised the event:

private void foo(object sender, System.EventArgs e)
{
   LinkButton lb = (LinkButton)sender;
   if(lb.ID == "linkbutton1")
   {
      count++;
   }
   else
   {
      count--;
   }
}

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button Click Event via XML,XSLT,javascript rhd110 XML 2 June 20th, 2007 08:16 AM
click event for vb YesNo button mohiddin52 Access VBA 2 January 14th, 2007 02:25 AM
Duplicate Control Creation on button click event kapi.goel C# 1 December 21st, 2005 02:42 PM
Input button click event not working Scott Rider General .NET 3 August 13th, 2005 12:20 PM
Trigger event on button click speedyH ASP.NET 1.x and 2.0 Application Design 3 June 27th, 2004 10:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.