Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:33:18+00:00 2026-05-28T03:33:18+00:00

Consider the following: protected void dgTask_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow)

  • 0

Consider the following:

protected void dgTask_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        LinkButton btn = (LinkButton)e.Row.Cells[4].FindControl("lnkBtnEdit");

        btn.Attributes.Add("onclick", "return Test();");
    }
}

Instead of a single click, how can I make it double click while clicking on the link button?

Edited

I have tried with the solution presented by *competent_tech* but the problem is that in that case it will intercept the single click.

I need to do some operation on single click and something else on double click. Please help me.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:33:18+00:00Added an answer on May 28, 2026 at 3:33 am

    You’d have to do something like this.

    Code behind.

    Linkbutton btn;
    btn.Attributes.Add("onClick", "OnClick();");
    

    then in your javascript you’ll need to define the OnClick function like this

    var clickCount = 0;
    var timeoutID  = 0;
    
    function OnClick()
    {
        clickCount++;
    
        if (clickCount >= 2) {
           clickCount = 0;          //reset clickCount
           clearTimeout(timeoutID); //stop the single click callback from being called
           DoubleClickFunction();   //perform your double click action
        }
        else if (clickCount == 1) {
           //create a callback that will be called in a few miliseconds
           //the callback time determines how long the user has to click a second time
    
           var callBack = function(){ 
                             //make sure this wasn't fired at
                             //the same time they double clicked
                             if (clickCount == 1) {      
                                clickCount = 0;         //reset the clickCount
                                SingleClickFunction();  //perform your single click action
                             }
                          };
    
           //This will call the callBack function in 500 milliseconds (1/2 second).
           //If by that time they haven't clicked the LinkButton again
           //We will perform the single click action. You can adjust the
           //Time here to control how quickly the user has to double click.
           timeoutID = setTimeout(callBack, 500); 
        }
    }
    

    You can either put the javascript directly into your .aspx file or add it dynamically when you add the LinkButton to the page. If you need to perform some action on the server side when the user single clicks or double clicks you can use the __doPostBack method. See here for more info on that.

    The problem with my approach is that the user will always have to wait the entire callback time before their single click action is performed. I don’t see any way around this as long as you are using single click/double click to distinguish what the user wants. If you find this delay to be too big of a problem you could always try something like click/shift+click to alternate between the actions. It probably wouldn’t be as intuitive that way but you would immediately know what the user wants and could respond immediately instead of waiting to see if the user clicks a second time.

    Let me know if you have any questions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
I'm having a hard time understanding this. Consider the following example: protected void Page_Load(object
Consider the following classes in Java class A { protected void methodA() { System.out.println(methodA()
Consider the following code: class Base { protected: virtual void methodDefinedInBase() = 0; }
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)
Consider following program: static void Main (string[] args) { int i; uint ui; i
Consider the following code: public partial class TeacherControlPanel : System.Web.UI.Page { protected string username
Consider the following interface: public interface IMyCallback { void SomeEvent(int someArg); } which is
Consider the following set of classes/Interfaces: class IFish{ public: virtual void eat() = 0;
Consider the following code snippet: public partial class DatabaseContext : DbContext { protected override

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.