'System.String' to 'System.Guid'

Last post 04-10-2008 5:00 AM by polynaux. 2 replies.

Sort Posts:

  • 'System.String' to 'System.Guid'

    04-09-2008, 1:34 PM
    • Member
      137 point Member
    • polynaux
    • Member since 03-13-2007, 3:12 PM
    • Posts 663

     Hi Guys,

     I have this working with a hyperlink field in a gridview.

      

                <asp:HyperLinkField DataNavigateUrlFields="UserID" DataNavigateUrlFormatString="userprofiles.aspx?UserID={0}"
                    DataTextField="UserName" HeaderText="User Name" Text="User Name" >
     

     

    I just want to same thing in a datagrid but I get this error:

      

    <asp:HyperLink ID="HyperLinkToUserProfile" runat="server" NavigateUrl="userprofiles.aspx?UserID={0}"><%# Eval("UserName")%></asp:HyperLink>
     

    Cannot convert value of parameter 'UserID' from 'System.String' to 'System.Guid'
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: Cannot convert value of parameter 'UserID' from 'System.String' to 'System.Guid'

     

    Does anyone know how to fix this?

     

    many thanks

    polynaux 

  • Re: 'System.String' to 'System.Guid'

    04-09-2008, 1:56 PM
    Answer
    • All-Star
      86,764 point All-Star
    • ecbruck
    • Member since 12-30-2005, 7:39 PM
    • Des Moines, IA
    • Posts 9,209
    • Moderator
      TrustedFriends-MVPs

    How about this? 

    <asp:hyperlink id="HyperLinkToUserProfile" runat="server" navigateurl='<%# Eval("UserID", "userprofiles.aspx?UserID={0}") %>'
    	text='<%# Eval("UserName") %>' />
    Thanks, Ed

    Microsoft MVP - ASP/ASP.NET

  • Re: 'System.String' to 'System.Guid'

    04-10-2008, 5:00 AM
    • Member
      137 point Member
    • polynaux
    • Member since 03-13-2007, 3:12 PM
    • Posts 663

     Many thanks ecbruck

     

    that worked ! 

Page 1 of 1 (3 items)