Hello All,
I am using a UltraWinGrid and i have implemented one cell of the grid to show email addresses as hyperlink .Problem is that when i click any where
in the cell it opens an outlook instance for me i want it should open the outlook only when i click on the email address not when i click any where in the cell (which may be the empty region left after the email address) for e.g *Prabhatc@cybage.com * here i want outlook to open when i click
onthe email address not when i click on the empty region of the cell .I am using this code.
Private Sub ContactsUltraGrid_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ContactsUltraGrid.MouseDown 'Implemented functionality on left click of mouse Dim mousePoint As System.Drawing.Point = New System.Drawing.Point(e.X, e.Y) Dim element As Infragistics.Win.UIElement = CType(sender, Infragistics.Win.UltraWinGrid.UltraGrid).DisplayLayout.UIElement.ElementFromPoint(mousePoint) Dim cell As Infragistics.Win.UltraWinGrid.UltraGridCell = CType(element.GetContext(GetType(Infragistics.Win.UltraWinGrid.UltraGridCell)), Infragistics.Win.UltraWinGrid.UltraGridCell) If cell Is Nothing Then Return If e.Button = System.Windows.Forms.MouseButtons.Left Then 'Here we figure out whether we have clicked on email link if yes then open outlook If cell.Column.Key = "Email" Then Dim strEmail As String = cell.Tag.ToString() If (strEmail.Trim().Length > 0) Then strEmail = "MailTo:" & strEmail 'Open OutLook System.Diagnostics.Process.Start(strEmail) End If End If End If End Sub
Please respond me..
Thanks a Lot,
Regards,
Prabhat Chauhan
Hi Daniel,
So store the value in the hyperlink as part of the value of the cell. So the Value of the cell would be something like this:
<a href="101">Detail</a>
<a href="102">Detail</a>
<a href="103">Detail</a>
Mike,
The approach you have described above works great, but I need to make a small adjustment. In my case, the hyperlink needs to show the same text for each row, although the value will be different. How can I achieve this?
Row 1: Text = "Detail", Value="101"
Row 2: Text = "Detail", Value="102"
Row 3: Text = "Detail", Value="103"
Thanks,
Daniel
Hi Jacob,
The LinkClicked event has a Context property on the event args. In the case of the WinGrid, this will be the UltraGridCell that was clicked. So you can examine the value of the cell or get the row from there.
Hi mike,
My case is also similar to this case. Actually i need to display a link inside the grid. But on click of the link i shouldnt launch any webpage. Instead i need to navigate to another page in my application. The thing is I need to get the row from the grid which i've got the mouse click. This is because the column in the grid where i've the link will not have unique value. I need some more values in the row from which i've done the mouse click to navigate to the appropriate view of my application. So is there any way to determain the row or atleast the cell from which the link mouse click appears. And also using this approach am getting another problem that is since am having some values in the columns as same - say i have value "100" that appears in two cells in the same column when i click one column in the cell the other value on focus also appears as though it is been clicked. So is there any way to resolve my issues. Am new to infragestics controls and also i dont know anything about the UltraFormattedTextEditor. Your help could be of much useful to me. Thank you so much for all your help in advance.
Thanks and regards.,
Jacob
Thanks Mike ,I will do same..