2016-04-07 7 views
1

フロントエンドにリピータを作成しました。複数のアイテムを追加する必要があります.2番目のアイテムは文字列であり、これはイメージsrcに追加する必要があります?以下はタプルを使って複数のアイテムをaspリピータに追加する

<asp:Repeater runat="server" ID="WeatherForcastWeek" > 
    <ItemTemplate> 
    <td> 
     <asp:Label runat="server" ID="Day1" /> 
     <asp:Image runat="server" ID="WeatherIcon" /> 
     <asp:Label runat="server" ID="Min" /> 
     <asp:Label runat="server" ID="Max" /> 
    </td> 
    </ItemTemplate> 
</asp:Repeater> 

あなたはASP.NET用のImageUrlプロパティを使用してアイテム結合構文を使用して値を渡す必要があるデータソースの種類

Tuple<string, string, double, double> 

答えて

3

あるWebフォーム<%#Item.Property#>

<asp:Repeater runat="server" ID="WeatherForcastWeek" ItemType="System.Tuple`4 [System.String,System.String,System.Double,System.Double]"> 
    <ItemTemplate> 
    <td> 
     <asp:Label runat="server" ID="Day1" Text="<%# Item.Item1 %>" /> 
     <asp:Image runat="server" ID="WeatherIcon" ImageUrl="<%# Item.Item2 %>" /> 
     <asp:Label runat="server" ID="Min" Text="<%# Item.Item3 %>"/> 
     <asp:Label runat="server" ID="Max" Text="<%# Item.Item4 %>"/> 
    </td> 
    </ItemTemplate> 
</asp:Repeater> 
+0

あなたの助けを借りてくれてありがとうフェルナンド!これは私の問題を解決した、私はそれがコードブロック、功徳と何か関係があったという気持ちがあった! –

関連する問題