This is a migrated thread and some comments may be shown as answers.

Dynamic NavigateUrlFormatString

7 Answers 212 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Justin Wilson
Top achievements
Rank 1
Justin Wilson asked on 24 Jun 2010, 06:41 PM
In the gridview I am trying to create a column where the user can see the tracking number of a package, click on it, and bring up a page with their package on it.  They can have tracking numbers from a couple different couriers.  The code below is not working.  Any Ideas?

<telerikGridView:GridViewDynamicHyperlinkColumn TargetName="_blank" SortMemberPath="TrackingNumber.TrackingNumberString" NavigateUrlFormatString="{Binding TrackingNumber.Courier.TrackingURL}" NavigateUrlMemberPaths="TrackingNumber.TrackingNumberString" DataMemberBinding="{Binding TrackingNumber.TrackingNumberString}" Header="Tracking Number" />

7 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 25 Jun 2010, 09:58 AM
Hello Justin,

 Could you please share the values of a typical record? I would like to see how the following properties look like:

  • TrackingNumber.TrackingNumberString
  • TrackingNumber.Courier.TrackingURL
Also, how exactly does the code you provided 'not work'?

Greetings,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Justin Wilson
Top achievements
Rank 1
answered on 25 Jun 2010, 12:39 PM

Below are the values.

 

 

                The error is a run time error which I have below.

 

                Set property 'Telerik.Windows.Controls.GridViewDynamicHyperlinkColumn.NavigateUrlFormatString' threw an exception. [Line: 2537 Position: 206]

 

Message: Unhandled Error in Silverlight Application

Code: 4004   

Category: ManagedRuntimeError      

Message: System.Windows.Markup.XamlParseException: Set property 'Telerik.Windows.Controls.GridViewDynamicHyperlinkColumn.NavigateUrlFormatString' threw an exception. [Line: 2537 Position: 206] ---> System.ArgumentException: Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.String'.

   at System.RuntimeType.TryChangeType(Object value, Binder binder, CultureInfo culture, Boolean needsSpecialCast)

   at System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)

   at System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)

   at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)

   at MS.Internal.XamlMemberInfo.SetValue(Object target, Object value)

   at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue)

   --- End of inner exception stack trace ---

   at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)

   at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)

   at MS.Internal.XcpImports.FrameworkElement_ApplyTemplate(FrameworkElement frameworkElement)

   at System.Windows.Controls.ItemContainerGenerator.LayoutStatesManager.GetElementRoot(Boolean templatesAreGenerated)

   at System.Windows.Controls.ItemContainerGenerator.LayoutStatesManager.Load()

   at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)

   at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 containerIndex, DependencyObject container, Boolean needPrepareContainer)

   at System.Windows.Controls.ItemsControl.AddContainers()

   at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj)    

 

Line: 56

Char: 13

Code: 0

URI: http://localhost:4681/ASGWarehouse.aspx

 

Hope this helps :)

0
Yavor Georgiev
Telerik team
answered on 25 Jun 2010, 12:51 PM
Hello Justin,

 Unfortunately, the way the DynamicHyperlink column works won't help you in your scenario. You can't have a varying format string. NavigateUrlFormatString is not event a Dependency Property.

What you can do to make your scenario work is use a regular Hyperlink column and apply a binding converter. You'll need to build the Uri in that binding converter and return it.

Please let me know if you need further assistance in this.

All the best,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Justin Wilson
Top achievements
Rank 1
answered on 25 Jun 2010, 12:54 PM
Thanks for the Help.  Any chance I can get an example, or is there a demo on the site I can look at?  The current hyperlink column example is pretty basic.

Thanks again!
0
Yavor Georgiev
Telerik team
answered on 25 Jun 2010, 01:34 PM
Hello Justin,

 I'm attaching a sample project.

Don't hesitate to contact me again if something comes up.

Best wishes,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Justin Wilson
Top achievements
Rank 1
answered on 25 Jun 2010, 01:50 PM
Thanks for the help.  Love the controls.  The clients love the too.  Now we are really wowing people.
0
Yavor Georgiev
Telerik team
answered on 25 Jun 2010, 01:58 PM
Hi Justin,

 Thanks. :) Your appreciation means a lot to us.

Sincerely yours,
Yavor Georgiev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Justin Wilson
Top achievements
Rank 1
Answers by
Yavor Georgiev
Telerik team
Justin Wilson
Top achievements
Rank 1
Share this question
or