急急急急急急急急急急急急急急急急!!!img添加汉字

gz5182009 2012-04-05 02:04:48
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataRow dr;
dt.Columns.Add(new System.Data.DataColumn("3月13日", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("3月14日", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("3月15日", typeof(System.String)));
String[] x = { "10%", "20%", "50%", "80%", "90%","100%" };
Random r = new Random();
for (int i = 0; i < 8; i++)
{
dr = dt.NewRow();
dr[0] = x[r.Next(0, x.Length)];
dr[1] = x[r.Next(0, x.Length)];
dr[2] = x[r.Next(0, x.Length)];
dt.Rows.Add(dr);
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="3月13日">
<ItemTemplate>
<div style="height:0px;text-align:center"><span style="position:relative;top:0px;z-index:10;height:20px;"><%#Eval("3月13日") %></span></div>
<div style="width:200px;position:relative;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月13日") %>" height="20" /></div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="3月14日">
<ItemTemplate>
<div style="height:0px;text-align:center"><span style="position:relative;top:0px;z-index:10;height:20px;"><%#Eval("3月14日") %></span></div>
<div style="width:200px;position:relative;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月14日") %>" height="20" /></div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="3月15日">
<ItemTemplate>
<div style="height:0px;text-align:center"><span style="position:relative;top:0px;z-index:10;height:20px;"><%#Eval("3月15日") %></span></div>
<div style="width:200px;position:relative;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月15日") %>" height="20" /></div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</form>
</body>
</html>

如何可以在img里面加上文字呢?我加了之后就是显示不出来
...全文
172 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
gz5182009 2012-04-05
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 的回复:]
跟图像没关系,你应该做一个渐变图片,ie6不支持png,

下面是兼容的代码,在IE6,7,8,9,Fireofx11,Chrome18、Safari,Oprea下均通过
HTML code
<%@ Page Language="C#" EnableViewState="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tran……
[/Quote]
孟子老大 为什么我一拖动GridView上面的字不跟着动呢
孟子E章 2012-04-05
  • 打赏
  • 举报
回复
跟图像没关系,你应该做一个渐变图片,ie6不支持png,

下面是兼容的代码,在IE6,7,8,9,Fireofx11,Chrome18、Safari,Oprea下均通过
<%@ Page Language="C#" EnableViewState="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
System.Data.DataTable dt = new System.Data.DataTable();
System.Data.DataRow dr;
dt.Columns.Add(new System.Data.DataColumn("3月13日", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("3月14日", typeof(System.String)));
dt.Columns.Add(new System.Data.DataColumn("3月15日", typeof(System.String)));
String[] x = { "10%", "20%", "50%", "80%", "90%", "100%" };
Random r = new Random();
for (int i = 0; i < 8; i++)
{
dr = dt.NewRow();
dr[0] = x[r.Next(0, x.Length)];
dr[1] = x[r.Next(0, x.Length)];
dr[2] = x[r.Next(0, x.Length)];
dt.Rows.Add(dr);
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
}

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="3月13日">
<ItemTemplate>
<div style="position: relative; width: 200px;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月13日") %>" height="20" /><br />
<div style="width: 200px; position: absolute; z-index: 100; top: 0px; text-align: center;"><%#Eval("3月13日") %></div>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="3月14日">
<ItemTemplate>
<div style="position: relative; width: 200px;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月14日") %>" height="20" /><br />
<div style="width: 200px; position: absolute; z-index: 100; top: 0px; text-align: center;"><%#Eval("3月14日") %></div>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="3月15日">
<ItemTemplate>
<div style="position: relative; width: 200px;"><img alt="" src="http://livedocs.adobe.com/flex/3_cn/langref/images/createGradientBox-2.jpg" width="<%#Eval("3月15日") %>" height="20" /><br />
<div style="width: 200px; position: absolute; z-index: 100; top: 0px; text-align: center;"><%#Eval("3月15日") %></div>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</form>
</body>
</html>


gz5182009 2012-04-05
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 的回复:]

引用 5 楼 的回复:

你的是ie6吧。其他浏览器都是正确的

是啊我就是ie6孟子老大你看看还有别的办法么
[/Quote]
我用的是.png跟.jpg都不行
孟子E章 2012-04-05
  • 打赏
  • 举报
回复
应该有啊。我看看
gz5182009 2012-04-05
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]

你的是ie6吧。其他浏览器都是正确的
[/Quote]
是啊我就是ie6孟子老大你看看还有别的办法么
mngzilin 2012-04-05
  • 打赏
  • 举报
回复
你直接设置div或者table单元格的style样式,添加背景图片不就行了,又不影响文字的添加

<div style="backgroud-img('img/1.jpg')" >文字</div>
<table><tr><td style="backgroud-img('img/1.jpg')"> 文字</td></tr></table>
孟子E章 2012-04-05
  • 打赏
  • 举报
回复
你的是ie6吧。其他浏览器都是正确的
Im_Sorry 2012-04-05
  • 打赏
  • 举报
回复
直接水印把!
骑猪看海 2012-04-05
  • 打赏
  • 举报
回复
网上搜下asp.net 图片水印
laichunlin 2012-04-05
  • 打赏
  • 举报
回复
用title

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧