Datagrid Mouse Event Compilation Error

G

Guest

I am trying to capture the mouse click position in a datagrid but I get the
following compilation error:

Compiler Error Message: BC30002: Type 'System.Windows.Forms.MouseEventArgs'
is not defined.

Source Error:

Line 84: Private myCheckBoxCol As Integer = 0 'my checkbox column
Line 85:
Line 86: Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseUp
Line 87:
Line 88: Dim hti As DataGrid.HitTestInfo = Me.dataGrid1.HitTest(e.X, e.Y)

I am using code behind.
Newbie to ASP Net.
Any help is greatly appreciated.

Thanks.
 
M

Marina Levit [MVP]

Does the datagrid have a MouseUp event? That seems highly unlikely, given
that this is an ASP.NET control, it isn't going to be doing callbacks to the
server for mouse events in the browser.

Additionally, MouseEventArgs is in they System.Windows.Forms namespace.
Anything in this namespace is not going to be usable in an ASP.NET web
application. That is for windows forms. You .aspx page is not a windows
form.

Programming for the web is significantly different then windows programming.

If you want client side mouse events, you are probably going to have to
manually figure out what kind of HTML the datagrid generates, attach
handlers on the client for your mouse events, and then handle appropriately.
Handling appropriately means you will have a javascript function to handle
the event. In theory that can reload the page, or make a server side call,
or whatever you want, but this function handler is going to be run on the
client and not on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top