我搜索了一下论坛,思归有一个回复是不可以:(
可那是2004年的贴子
我想现在都VS2005,ASP.NET 2.0了
为什么还不可以呢??
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="54" valign="top"><a href="showclass.aspx?classid=<%# DataBinder.Eval(Container.DataItem, "ClassID")%>" ><img src="<%# DataBinder.Eval(Container.DataItem, "ClassPicUrl")%>" style="border:0" alt="<%#DataBinder.Eval(Container.DataItem, "ClassName")%>" id="IMG1" /></a></td>
<td align="center" valign="middle"><img src="images/more.gif" alt="more" width="40" height="12" /></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="1">
<tr>
<td align="center" bgcolor="#eeeee4"></td>
</tr>
</table>
</td>
</tr>
</table>
</HeaderTemplate>我想在表头显示图片,但图片地址是调用的数据库里,怎么办呢??
可那是2004年的贴子
我想现在都VS2005,ASP.NET 2.0了
为什么还不可以呢??
<HeaderTemplate>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="54" valign="top"><a href="showclass.aspx?classid=<%# DataBinder.Eval(Container.DataItem, "ClassID")%>" ><img src="<%# DataBinder.Eval(Container.DataItem, "ClassPicUrl")%>" style="border:0" alt="<%#DataBinder.Eval(Container.DataItem, "ClassName")%>" id="IMG1" /></a></td>
<td align="center" valign="middle"><img src="images/more.gif" alt="more" width="40" height="12" /></td>
</tr>
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="1">
<tr>
<td align="center" bgcolor="#eeeee4"></td>
</tr>
</table>
</td>
</tr>
</table>
</HeaderTemplate>我想在表头显示图片,但图片地址是调用的数据库里,怎么办呢??
解决方案 »
- jQuery ajax 简单的
- 这个方法怎样用
- 关于动态生成 实现新页面 的问题,求解
- 刚完成的一个系统后台管理框架,请提点建议
- 高手请进!写一个webform的控件,在没把cs文件编译成dll再放到窗口之前,有没有办法调试控件?
- 请问:我的台式的是赛扬1.7 ,256做.net开发, 那我如果想买个笔记本用,该用什么配置的呢?(在线等,望版主保留此贴二天)谢谢!!!!
- 关于DataGrid中固定表头用到 overflow,但我做的变成滚动条在DataGrid中,可不可以把滚动条放到datagrid外面呢
- 求正则表达式及时间的比较
- web自定义控件的问题
- asp.net中“System.IO.IOException: 没有更多文件”是怎么回事?
- 输入字符串的问题
- 怎样在一个aspx页面上做一个倒记时的显示(或者计时期)
Dim an As HtmlAnchor = CType(e.Item.FindControl("a1"), HtmlAnchor)
Dim img As HtmlImage = CType(e.Item.FindControl("IMG1"), HtmlImage) an.InnerHtml = "showclass.aspx?classid=21323"
img.Src = "http://www.csdn.net/Images/logo_csdn.gif"
img.Alt = "this is the property alt of the img."
End If
{
if (e.Item.ItemType == ListItemType.Header)
{
HtmlAnchor an = System.Convert.ChangeType(e.Item.FindControl("an"), HtmlAnchor);
HtmlImage img = System.Convert.ChangeType(e.Item.FindControl("img"), HtmlImage);
an.InnerHtml = "showclass.aspx?classid=";
img.Src = "sdsd";
img.Alt = "sdfdsf";
}
}编译器错误信息: CS0118: “System.Web.UI.HtmlControls.HtmlAnchor”是“类型”,但此处被当做“变量”来使用这是怎么回事呀
方法高!!
<HeaderTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src='../uploadfiles/userheaderimage/<%=数据库保存的图片文件%>' border="0" align="absmiddle"
width="10" height="10" />
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:DataList>
HtmlImage img = System.Convert.ChangeType(e.Item.FindControl("img"), HtmlImage);==>>HtmlAnchor an = (HtmlAnchor)e.Item.FindControl("an");
HtmlImage img = (HtmlImage)e.Item.FindControl("img");
Convert.ChangeType按你这种调用,第二个参数要求的是一个System.Type类的参数, 很明显你这个HtmlAnchor不是, 所以会出现
编译器错误信息: CS0118: “System.Web.UI.HtmlControls.HtmlAnchor”是“类型”,但此处被当做“变量”来使用
HtmlImage img = (HtmlImage)e.Item.FindControl("img");
an.InnerHtml = "showclass.aspx?classid=" + myDb_Conn.myDataSet.Tables["class"].Rows[0]["ClassID"];
img.Src = myDb_Conn.myDataSet.Tables["class"].Rows[0]["ClassPicUrl"].ToString();
Response.Write(img.Src);
img.Alt = myDb_Conn.myDataSet.Tables["class"].Rows[0]["ClassName"].ToString();
现在这样
Response.Write(img.Src);能够写出images/keyan.gif 即图片地址,但
图片就是不显示!
width="10" height="10" />这种方法不行!
这样就不显示
<a id="an" runat="server"><a><img style="border:0" id="img" runat="server" />
这样就显示
难道这个不可以嵌套吗??