Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How to display List<String> in FormView

$
0
0
I have a FormView that has a datasource bind as a object which is a WCF service. In the WCF Service i have a Object PublicationDetail which has a attribute List<string> authors;

I want to join the contents of the list and print them out in the form view however i fall on the following error:

Unable to cast object of type 'System.String[]' to type
'System.Collections.Generic.List`1[System.String]'.


And the code:

<asp:Label ID="AuthorsLabel" runat="server" Text='<%# String.Join( ",", ((List<string>)Eval("Authors")).ToArray()) %>' />


How can i format this List<string> to a string. If i say
<%# Bind("Authors") or Eval("Authors") %>
, i get the following output: System.String[] everything else gives an compile error.

Should note im using Visual Studio 2012

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>