Solved

gridview double click event

Posted on 2010-09-02
7
833 Views
Last Modified: 2013-12-17
Hi! How to capture double click event of gridview?
0
Comment
Question by:PagodNaUtak
  • 4
  • 2
7 Comments
 
LVL 10

Expert Comment

by:himanshut
Comment Utility
Handles Double click event:
string variable;
 
        private void dataGridView1_CellMouseDoubleClick( object sender, DataGridViewCellMouseEventArgs e )
        {
            variable = dataGridView1[e.ColumnIndex,e.RowIndex].Value ;
        }

Open in new window

0
 
LVL 8

Author Comment

by:PagodNaUtak
Comment Utility
I am using ASP?
0
 
LVL 8

Author Comment

by:PagodNaUtak
Comment Utility
ASP.NET I mean...
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 8

Expert Comment

by:Mohit Vijay
Comment Utility
You can use JavaScript.

write ondblclick event of javascript.

in this ondblclick of javascript you can click a button using JavaScript code like

document.getElementById('YourButtonId').click();


on click of this button, you can catch in your code.
0
 
LVL 8

Author Comment

by:PagodNaUtak
Comment Utility
Can you show some example code?
0
 
LVL 8

Expert Comment

by:Mohit Vijay
Comment Utility
ok

place a button on you asp.net page. set is visibility:hidden (style), assume its name/id is "yourbutton"

with your gridview control write

ondblclick="javascript:Catchdblclickevent();"


write a javascript function in script tag for javascript

function Catchdblclickevent()
{
document.getElementById('yourbutton').click();
}

Now this click event will behave same as user clicked on it, so hopefully you can trap it?

Is above sample ok?



0
 
LVL 8

Accepted Solution

by:
PagodNaUtak earned 0 total points
Comment Utility
Here is myCode, I did it... :)
 protected override void OnInit(System.EventArgs e)

        {

            try

            {

                base.OnInit(e);

                this.gdviewApplicants.RowCommand += new GridViewCommandEventHandler(gdviewApplicants_RowCommand);

                this.gdviewApplicants.RowEditing += new GridViewEditEventHandler(gdviewApplicants_RowEditing);

                this.gdviewApplicants.RowDataBound += new GridViewRowEventHandler(gdviewApplicants_RowDataBound);

           

            }

            catch (System.Exception ex)

            { this.HandleException(ex); }

        }



protected void gdviewApplicants_RowEditing(Object sender, GridViewEditEventArgs e)

        {





        }



        protected void gdviewApplicants_RowCommand(object sender, GridViewCommandEventArgs e)

        {

            int selectIndex = int.Parse(e.CommandArgument.ToString());

            

            String commandName = e.CommandName;

            if (commandName == "Edit")

            {

                int ID = Convert.ToInt32(gdviewApplicants.Rows[Convert.ToInt32(e.CommandArgument)].Cells[1].Text);

                

            }





        }



        protected void gdviewApplicants_RowDataBound(object sender, GridViewRowEventArgs e)

        {



            // 

        }

 

Open in new window

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now