It seems that WebDataGrid does not support the double click event on a row? Am I missing something? Is this feature scheduled for a future release?
Regards,
Arthur
Hello Arthur,
Indeed, for the time being double click events are not exposed on the grid core and on the grid selection behavior. This will certainly be addressed in next releases of the product, meanwhile you can use something like this to attach double click event on grid row (in this particular example I am attaching double click event on the third row of the grid)
var grid = $find("<%= WebDataGrid1.ClientID %>"); var gridRow = grid.get_rows().get_row(2); gridRow.get_element().ondblclick = function() { alert("Double click"); }
Where i need to write the code.
Hello,
In ASP.NET AJAX for client-side there is a reserved client-side event (function in javascript) called pageLoad - you can execute the code there.
e.g.
function pageLoad(sender, args)
{
// init code for double click here
}
Hi
Thanks for your Reply.
I have put the above code in pageLoad function.Bt it not working.I need to the solution for when i double click any row i getting the cell value.How can i raise the double click event and how can i assign that event to webdatagrid?
Yes -- I see. I have tested that and it works for me, but I guess my page is small and pageLoad gets executed after initializing the grid. I have found a general way to do that -- there is a Initialize event for the grid which I think is exacty what you need (in this sample we attach double click to the first row)
<script language="javascript"> function initGrid() { var grid = $find("<%= WebDataGrid1.ClientID %>"); var gridRow = grid.get_rows().get_row(0); gridRow.get_element().ondblclick = function() { alert("Double click"); } } </script> <ig:WebDataGrid runat="server" ID="WebDataGrid1" DataSourceID="AccessDataSource1"> <ClientEvents Initialize="initGrid" /> </ig:WebDataGrid> <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName] FROM [Employees]"> </asp:AccessDataSource>
Hi Rumen
This might be a silly question, but is there a way to set this on all rows without looping through them all and adding the ondblclick function?
Thanks
Andy
Thats great thanks Alex