Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
780
HyperLinkButton binding.
posted

How do I bind the navigate url for a HyperlinkColumn?  I want to basically accomplish this in the cell:

<HyperlinkButton Content="Product Name" NavigateUri=http://mysite.com/product.aspx?ID=1 TargetName="_blank" />

With the content bound to my product class Name field and the navigate uri coming from its Url field.  I just can't find where to set the navigate uri.  I tried this and the URI showed up as the text.

 

<

 

igDataGrid:HyperlinkColumn Key="Name" ContentBinding="{Binding Url}" TargetName="_blank" />

 

 

The Url showed as the text, and then clicking it gives theexception below (I assume because it's trying to navigate to "" since I haven't set it).  I'm sure I'm missing something easy here, but can't see how to set the navigate uri.

Thanks,
Keith

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; FDM)
Timestamp: Sun, 2 Aug 2009 23:57:40 UTC


Message: Unhandled Error in Silverlight Application
Code: 4004   
Category: ManagedRuntimeError      
Message: System.NotSupportedException: Cannot navigate to locations relative to a page.
   at System.Windows.Controls.HyperlinkButton.GetAbsoluteUri()
   at System.Windows.Controls.HyperlinkButton.Navigate()
   at System.Windows.Controls.HyperlinkButton.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)    

Line: 54
Char: 13
Code: 0
URI: file:///C:/InfoMod/Silverlight%20Examples/InfragisticsGridTest/Bin/Debug/TestPage.html

 

 

 

 

 


 

 

 

Parents
No Data
Reply
  • 40030
    Verified Answer
    Offline posted

    Hi Keith, 

    The Key you're using for the HyperlinkColumn, must map to an actual URI or a string representation of a URI in your datasource.  To customize the Text of what gets displayed to the end user, you can use the Content property, if the field should be the same for every row, or the ContentBinding property to map to another property on your object. 

    Hope this helps clear some things up.

    -SteveZ

Children