HyperlinkButton in GridView

13 posts, 0 answers
  1. Chris
    Chris avatar
    2 posts
    Member since:
    May 2009

    Posted 25 Sep 2009 Link to this post

    I want to put a HyperlinkButton in my GridView but I want to pass in a query string to the NavigateUri from my DataSource collection.  I know doesn't work but Is this even possible?

    <

     

    telerikGridView:GridViewColumn Width="*">

     

     

     

        <telerikGridView:GridViewColumn.CellStyle>

     

     

     

            <Style TargetType="GridView:GridViewCell">

     

     

     

                <Setter Property="Template">

     

     

     

                    <Setter.Value>

     

     

     

                        <ControlTemplate TargetType="GridView:GridViewCell">

     

     

     

                            <Border BorderThickness="0,0,0,1" BorderBrush="#FFB3B3B3">

     

     

     

                                <HyperlinkButton x:Name="ViewDetailsButton" Content="View Details" NavigateUri="http://www.myurl.com/page.aspx?id={Binding Id}"/>

     

     

     

                            </Border>

     

     

     

                        </ControlTemplate>

     

     

     

                    </Setter.Value>

     

     

     

                </Setter>

     

     

     

            </Style>

     

     

     

        </telerikGridView:GridViewColumn.CellStyle>

     

     

     

    </telerikGridView:GridViewColumn>

    Chris Buchanan
    iomer Internet Solutions Inc.

     

  2. Ludovic Gerbault
    Ludovic Gerbault avatar
    226 posts
    Member since:
    Apr 2009

    Posted 25 Sep 2009 Link to this post

    I think you could use some sort of converter, like

     <HyperlinkButton x:Name="ViewDetailsButton" Content="View Details" NavigateUri="{Binding Id, Converter={StaticResource UriConverter}}" />

    And in your converter, you put something like

    return "http://www.myurl.com/page.aspx?id="+value.toString();
  3. DevCraft banner
  4. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 26 Sep 2009 Link to this post

    Hi guys,

    In our latest internal build we introduced two new columns: GridViewHyperlinkColumn and GridViewDynamicHyperlinkColumn. Here is an example for both columns:

    ...
    <telerik:GridViewHyperlinkColumn DataMemberBinding="{Binding Url}" ContentBinding="{Binding CompanyName}" />
    ...

    <telerik:GridViewDynamicHyperlinkColumn DataFormatString="Send mail to: {0}"
                                                     DataMemberBinding="{Binding CompanyName}"
                                                     NavigateUrlMemberPaths="ContactName, CompanyName"
                                                     NavigateUrlFormatString="mailto:{0}@{1}.com"/>

    or

    <telerik:GridViewDynamicHyperlinkColumn DataMemberBinding="{Binding MyProperty1}"
                                           TargetName="_blank"
                                           NavigateUrlMemberPaths="MyProperty2, MyProperty3"
                                           NavigateUrlFormatString="http://www.myurl.com/page.aspx?q1={0}&q2={1}"/>


    All the best,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Chris
    Chris avatar
    2 posts
    Member since:
    May 2009

    Posted 28 Sep 2009 Link to this post

    Will this be in Q3, and if so do you have a release date for that?
  6. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Sep 2009 Link to this post

    Hello Chris,

    You can download our latest internal build even now:
    http://www.telerik.com/account/latest-internal-builds.aspx

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Axel Erize
    Axel Erize avatar
    1 posts
    Member since:
    Dec 2009

    Posted 07 Dec 2009 Link to this post

    Hello,

    Could you please explain how to programmatically add one GridViewHyperlinkColumn and one GridViewDynamicHyperlinkColumn to a RadGridView?

    Thank you,

    Axel
  8. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Dec 2009 Link to this post

    Hello,

    There are no difference compared to other grid columns. All you need is to create the column, set desired properties and add the column in the Columns collection.

    Sincerely yours,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 05 Apr 2010 Link to this post

    It seems that your properties do not exist anymore in Silverlight 4
    they seems to have changed for DataMemberBinding, ContentBinding and DataFormatBinding
  10. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 05 Apr 2010 Link to this post

    Cannot navigate external relative to a page ?
    when I click on the email

    Here's my code

    GridViewHyperlinkColumn gvhc = new GridViewHyperlinkColumn();  
    gvhc.DataMemberBinding = new System.Windows.Data.Binding() { Path = new PropertyPath(BindingPath) };  
    gvhc.ContentBinding = new System.Windows.Data.Binding() { Path = new PropertyPath(BindingPath) };  
    gvhc.DataFormatString = "mailto:{0}";  
     

    I also tried with "{}{mailto:{0}" with no luck
    I tried "{}{0}" still no luck

    For your information, the real value is a complete email like joe@company.com
  11. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 06 Apr 2010 Link to this post

    Hi,

    Please use GridViewDynamicHyperlinkColumn instead - I've attached an example project.

    Best wishes,
    Vlad
    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.
  12. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 06 Apr 2010 Link to this post

    It works well.  Thank you

    So if I understand, GridViewDynamicHyperlinkColumn is used for hyperlinks and emails so what is the other for ?
    Are these details found in the help somewhere ?
  13. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Apr 2010 Link to this post

    Hello Marc,

    GridViewHyperlinkColumn will bind ContentProperty and NavigateUriProperty to the generated HyperlinkButton however GridViewDynamicHyperlinkColumn will construct Uri on the fly and will assign this Uri to NavigateUri of the generated HyperlinkButton directly.

    Your actual data (joe@company.com) is not valid Uri - if this was mailto:joe@company.com GridViewHyperlinkColumn will work as well. In Silverlight 4 you can set StringFormat for your DataMemberBinding and this will affect the Uri.

    Greetings,
    Vlad
    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.
  14. Marc Roussel
    Marc Roussel avatar
    429 posts
    Member since:
    Dec 2009

    Posted 08 Apr 2010 Link to this post

    Ah now I see.  Thank you
Back to Top
DevCraft banner