?
Solved

How to handle doubleClick event in datagrid?

Posted on 2006-06-16
5
Medium Priority
?
468 Views
Last Modified: 2012-08-13
Hi, I am looking for a code in VBScript to handle doubleClick event in datagrid that return row data when I doubleclick on a row?

Thanks.
0
Comment
Question by:Abdu_Allah
[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
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
kGenius earned 2000 total points
ID: 16926171
Private Sub DataGrid_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemCreated
 
  Dim DataGridID As String = CType(sender, DataGrid).ID + "$"
   
  If (e.Item.ItemType = ListItemType.Item) OrElse (e.Item.ItemType = ListItemType.AlternatingItem) OrElse(e.Item.ItemType = ListItemType.SelectedItem) Then
       e.Item.Attributes.Add("ondblclick", "javascript:__doPostBack('" + DataGridID + "_ctl" + (e.Item.ItemIndex + 3).ToString + "$_ctl0','')")
  End If
End Sub


Hope this'll help
kGenius
0
 
LVL 7

Expert Comment

by:kGenius
ID: 16926173
Then you catch the event with OnSelectedIndexChanged on read the data of the selected row
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 16926205
Could you please explain how to catch the event with OnSelectedIndexChanged on read the data of the selected row
If there is a sample code that will be better. Thanks.
0
 
LVL 7

Expert Comment

by:kGenius
ID: 16926307
ie
Protected Sub DataGrid1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChange

  'read your data here ie:
  Dim myProperty = DataGrid1.SelectedItem.Cells(0).Text
  'etc...
End Sub



One other remark in your HTML code (datagrid columns) you must provide a ButtonColumn
<asp:ButtonColumn HeaderText="" ButtonType="LinkButton" Text="Select" CommandName="Select">
You can set Visible=false .
But it's needed to simulate the "Select" command provided by the doubleclick javascript in the previous post.

Hope this 'll help
kGenius
0
 
LVL 3

Author Comment

by:Abdu_Allah
ID: 16926386
Thank you it is work fine now that you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

770 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