如何在ItemTemplate里插入图片呢?
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="sid" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="subname" HeaderText="subname"
SortExpression="subname" />
<asp:TemplateField HeaderText="管理" SortExpression="rank">
<ItemTemplate>
<asp:Button ID="Button0" runat="server" Text="删除" CommandArgument='<%# Bind("sid") %>' OnClick="DeleteSub" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:trainConnectionString %>"
SelectCommand="SELECT [subaddress], [subname], [sid] FROM [subs] WHERE ([vid] = @vid)">
<SelectParameters>
<asp:SessionParameter Name="vid" SessionField="vid" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
--------------------------------
我往上面的<ItemTemplate>...</ItemTemplate>里面再添加一个
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("subaddress") %>' />
调试时就会出错,说是ImageUrl='<%# Bind("subaddress") %>'这样写错误,把#改成=也是不行,请问要怎么做呢??求指导谢谢
------解决方案--------------------Eval()
用那么多服务器控件干嘛?
<img src="<%#Eval('imgUrl')%>" />