How to add hyperlink to an ultragrid column
where the link directs to new page consisting of the data related to tha ID
i m vb.net developer and i add hyper link in ultra grid in this way
Private Sub UltraGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles UltraGrid1.MouseDown Dim objClickedElement As UIElement = Me.UltraGrid1.DisplayLayout.UIElement.ElementFromPoint(UltraGrid1.PointToClient(Form1.MousePosition))
If objClickedElement Is Nothing Then Return
Dim objCellElement As CellUIElement = objClickedElement.GetAncestor(GetType(Infragistics.Win.UltraWinGrid.CellUIElement))
If objCellElement Is Nothing Then Return
Dim objCell As UltraGridCell = CType(objCellElement.GetContext(GetType(UltraGridCell)), UltraGridCell)
If objCell Is Nothing Then Return '/////////////name here as key///////////// If objCell.Column.Key = "name" Then System.Diagnostics.Process.Start(objCell.Tag.ToString) End If '/////hyper link code is there and some part is above is end there////////// End Sub
Private Sub UltraGrid1_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles UltraGrid1.InitializeRow
'///////////////part for add hyperlink in ultragrid///////////////
e.Row.Cells(1).Tag = "http://www.google.com/search?hl=en&q=" + e.Row.Cells(2).Value.ToString.Replace(" ", "+") End Sub
Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
'//////////////////FOR ADD VALUE LIST CODE IS END HERE e.Layout.Bands(0).Columns(1).CellActivation = Infragistics.Win.UltraWinGrid.Activation.ActivateOnly e.Layout.Bands(0).Columns(1).CellAppearance.ForeColor = Color.Blue e.Layout.Bands(0).Columns(1).CellAppearance.FontData.Underline = Infragistics.Win.DefaultableBoolean.True e.Layout.Bands(0).Columns(1).CellAppearance.Cursor = Cursors.Hand End Sub
hope that code will help u
if u have more issue about ultragrid please visit that link
http://ahmadkhalid44.blogspot.com/
Regards:
Ahmad khalid
hi
Where should i Write this
OnInitializeRow="ultrawebgrid1_InitializeRow
Pls help
Regards
Chandrakant
I found that if I populate the Value in the InitializeRow with anything, then the TargetURL works. I was using NullText property to display the Text for the link to the user, and I would be fine to use DefaultValue instead, but in the designer the DefaultValue property is grayed out, so the Value property has to be populated in the InitializeRow.
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells.FromKey("UnboundColumn").Value= "Click Me!"; e.Row.Cells.FromKey("UnboundColumn").TargetURL = "Page.aspx"; }
I am having the same problem where setting the TargetUrl has no effect. All I have done is add an unbound column and set the Key and NullText properties, nothing else. Then in the InitializeRow, I have set the TargetUrl to the appropriate page, but when clicked, it just goes to the "directory listing".
Here is my InitializeRow:
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells.FromKey("UnboundColumn").TargetURL = "Page.aspx"; }
The only way I have got the hyperlink column to work is by setting the text to HTML, but this seems like a hack, and I would sure like to get the TargetURL way working:
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells.FromKey("UnboundColumn").Text = "<a href='Page.aspx'>Show Page</a>"; }
Any ideas on what I am missing? I am using version 2009 volume 1 (9.1.20091.1015).
hi guys,
Looking at this thread, and a few others when searching. I have tried the approach listed in this thread, and this KB (http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1383) but it isn't working. When I click my link, I go to the directory. Any help would be much appreciated. I am sure it is something simple I am missing.
my initialize row (i set a break point, and it is being hit) but my link takes me to http://localhost:2917/ (Directory Listing -- /)
protected void uwg_NoFutureApts_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells[0].TargetURL = "@[_blank]RescheduleAttempt.aspx?id=" + e.Row.Cells[7].Value.ToString(); }