====DataGrid的问题。UP者有分。======

Proyang 2004-07-28 02:45:53
<asp:datagrid id="DataGrid1" runat="server" AllowPaging="True" Width="100%" BorderColor="#E7E7FF"
BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3" GridLines="Horizontal" AutoGenerateColumns="False"
Font-Size="10pt">
<SelectedItemStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#738A9C"></SelectedItemStyle>
<AlternatingItemStyle BackColor="#F7F7F7"></AlternatingItemStyle>
<ItemStyle ForeColor="#4A3C8C" BackColor="#E7E7FF"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="#F7F7F7" BackColor="#4A3C8C"></HeaderStyle>
<FooterStyle ForeColor="#4A3C8C" BackColor="#B5C7DE"></FooterStyle>
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<FONT face="宋体">文件名</FONT>
</HeaderTemplate>
<asp:TemplateColumn>
<HeaderTemplate>
<FONT face="宋体">上传时间</FONT>
</HeaderTemplate>
<ItemTemplate>
<asp:Label id="Label1" runat="server">
<%# DataBinder.Eval(Container.DataItem, "上传时间") %>
</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>

。。。。
private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{

Control coll;
if((e.Item.ItemType==ListItemType.Item)||(e.Item.ItemType==ListItemType.AlternatingItem))
{

//Response.Write("trtr<br/>");
//Response.Write(e.Item.Cells.Count);
coll = e.Item.FindControl("Label1");
Label temp = (Label) coll;
Response.Write(temp.Text);
}

}

为什么Response.Write(temp.Text); 什么也不出来呢???
...全文
85 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Proyang 2004-07-28
  • 打赏
  • 举报
回复
hehe,谢谢CMIC(大象)。
原来我犯了一个这么愚昧的错误。
CMIC 2004-07-28
  • 打赏
  • 举报
回复
<asp:Label id="Label1" runat="server">
<%# DataBinder.Eval(Container.DataItem, "上传时间") %>
</asp:Label>
--------------------------------------------------------------
<asp:Label id="Label1" runat="server" Text=<%# DataBinder.Eval(Container.DataItem, "上传时间") %>>
</asp:Label>
adminyao 2004-07-28
  • 打赏
  • 举报
回复
UP
yyf_321 2004-07-28
  • 打赏
  • 举报
回复
不明白,但为了分先up一下
realzhaoxin 2004-07-28
  • 打赏
  • 举报
回复
up

62,242

社区成员

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

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

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

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