Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

gridview double click event

Posted on 2010-09-02
7
Medium Priority
?
846 Views
Last Modified: 2013-12-17
Hi! How to capture double click event of gridview?
0
Comment
Question by:PagodNaUtak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 10

Expert Comment

by:himanshut
ID: 33593110
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
ID: 33593231
I am using ASP?
0
 
LVL 8

Author Comment

by:PagodNaUtak
ID: 33593232
ASP.NET I mean...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 8

Expert Comment

by:Mohit Vijay
ID: 33593674
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
ID: 33593739
Can you show some example code?
0
 
LVL 8

Expert Comment

by:Mohit Vijay
ID: 33593764
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
ID: 33593821
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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 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