注册 登录
编程论坛 ASP.NET技术论坛

GridView界面设置问题.......

benbenmeng 发布于 2007-04-28 11:18, 1049 次点击
只有本站会员才能查看附件,请 登录

想实现这样的效果,但是设置的gridview不行,大家能不能帮我设置下.........
我的代码如下
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderWidth="0px"
ShowFooter="true" CellSpacing="0" CellPadding="0" OnPageIndexChanging="GridView1_PageIndexChanging"
Width="100%"  AllowPaging="True" AllowSorting="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table width="90%" border="1" cellPadding="0" cellSpacing="0" style="border-bottom-color:#cfcfcf; border-left-color:#cfcfcf;border-right-color:#cfcfcf;">
<tr style="background-color:#dbdbdb;" valign="top">
<td style="width:10%;height:20px">登记人</td>
<td style="width:40%;" align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%#DataBinder.Eval(Container.DataItem,"Writer")%></td>
<td style="width:10%;">登记日期</td>
<td style="width:40%;" align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%#DataBinder.Eval(Container.DataItem,"WriteDate")%></td></tr>
<tr><td style="width:10%;height:50px" align="center">日志信息</td>
<td colspan="3" align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%#DataBinder.Eval(Container.DataItem,"WriteInfo")%></td></tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
我的图片效果是

只有本站会员才能查看附件,请 登录



上面差了个线条~~~~~~~~~~~~~~~
7 回复
#2
djx5202007-04-28 14:30

你在模板里画个table然后丢几个lable按上面的样式排好,在用<%#Eval()%>绑
后台的代码就像平时绑一样就可以了

#3
benbenmeng2007-04-28 14:53
不是很明白你讲的方法,可不可以麻烦你贴个代码??/
我那上面基本上已经实现,现在是table最上面的线条没有..............
#4
卡洛2007-04-28 14:55
<table width="90%" border="1" cellPadding="0" cellSpacing="0" style="border-bottom-color:#cfcfcf; border-left-color:#cfcfcf;border-right-color:#cfcfcf;">

你这里少了top那条线。当然没咯``
#5
benbenmeng2007-04-28 16:25
回复:(卡洛)
知道 ,但是那个table在geidview内是重复的,要是加了的话,第一个底部和第二个的顶部就重复了,显的很粗,所以想问有没有办法补救那个最上面的线条啊
#6
卡洛2007-04-28 16:29
<table width="90%" border="1" cellPadding="0" cellSpacing="0" style="border-bottom-color:#cfcfcf; border-left-color:#cfcfcf;border-right-color:#cfcfcf;">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BorderWidth="0px"
ShowFooter="true" CellSpacing="0" CellPadding="0" OnPageIndexChanging="GridView1_PageIndexChanging"
Width="100%"  AllowPaging="True" AllowSorting="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>

<tr style="background-color:#dbdbdb;" valign="top">
<td style="width:10%;height:20px">登记人</td>
<td style="width:40%;" align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%#DataBinder.Eval(Container.DataItem,"Writer")%></td>
<td style="width:10%;">登记日期</td>
<td style="width:40%;" align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%#DataBinder.Eval(Container.DataItem,"WriteDate")%></td></tr>
<tr><td style="width:10%;height:50px" align="center">日志信息</td>
<td colspan="3" align="left">&nbsp;&nbsp;&nbsp;&nbsp;<%#DataBinder.Eval(Container.DataItem,"WriteInfo")%></td></tr>

</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</table>

那你这样改咯。有重复数据让他自动添家 TR就可以了。
#7
benbenmeng2007-04-30 11:08
回复:(benbenmeng)回复:(卡洛)
只有本站会员才能查看附件,请 登录


我试了,就变成上面这样了,呵呵,郁闷,还有高招没???
谢谢回复哦...........
#8
从小到大2007-04-30 20:28

直接写个控件 循环显示就可以了 我是这样做的

1