Gid to String

martedì 25 aprile 2006 - 05.01

aabruzzese Profilo | Junior Member


Sto cercando una soluzione a questo problema:


Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30311: Value of type 'System.Guid' cannot be converted to 'String'.

Source Error:



Line 348: <asp:TemplateField SortExpression="avatar">
Line 349:<ItemTemplate>
Line 350:<asp:Image ID="Image1" runat="server" ImageUrl='<%# "AvatarImagefetch.ashx?UserName=" & CStr(new Guid(Eval("UserID").ToString()))) %>'/>
Line 351:</ItemTemplate>
Line 352:

Per mandare un GUID ad un altra pagina ma come una STRING e non un GUID.

USERID e una colonna di typo GUID.



Angelo Abruzzese

Brainkiller Profilo | Guru

>Per mandare un GUID ad un altra pagina ma come una STRING e non
>un GUID.
>USERID e una colonna di typo GUID.

Perchè devi creare una nuova istanza di una struttura Guid ?
Non puoi provare a mettere semplicemente Eval("UserID").ToString() ?
Ciao

David De Giacomi
Microsoft MVP
http://blogs.dotnethell.it/david/

aabruzzese Profilo | Junior Member


Ciao David,

Cercando o trovato :

<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# "AvatarImagefetch.ashx?MemberId=" & DataBinder.Eval(Container.DataItem,"UserId").ToString %>'/>
</ItemTemplate>

inveci di :

CStr(Eval("UserID").ToString)

con che ti risulta un Errore : Value of type 'System.Guid' cannot be converted to 'String'

Ancora meglio:

<%# String.Concat("AvatarImagefetch.ashx?MemberId=", Eval("UserID")) %>


String.Concat can accept an object and will automatically convert it to a string



Angelo Abruzzese
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5