首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

如何才能生成以前正常的表格呢

2012-01-30 
怎么才能生成以前正常的表格呢?我想生成这样的表格:tablecellspacing 1 cellpadding 0 width 100

怎么才能生成以前正常的表格呢?
我想生成这样的表格:
<table   cellspacing= "1 "   cellpadding= "0 "   width= "100% "   bgcolor= "#63747c "   border= "0 ">
<tr   bgcolor= "#f2f2f2 ">
<td   align= "center "   height= "22 "> 日期 </td>
<td   align= "center "   height= "22 "> 所有视频播放次数 </td>
<td   align= "center "   height= "22 "> 广告投放次数 </td>
</tr>
<---循环体>

<tr   bgcolor= '#fafafa '> <td   align= 'center '   height= '22 '> </td> <td   align= 'right '   height= '22 '>
                </td> <td   align= 'right '   height= '22 '>
                        </td> </tr> <tr   bgcolor= '#fafafa '> <td   align= 'center '   height= '22 '> </td> <td   align= 'right '   height= '22 '>
                                </td> <td   align= 'right '   height= '22 '>
                                        </td> </tr> <tr   bgcolor= '#fafafa '> <td   align= 'center '   height= '22 '> </td> <td   align= 'right '   height= '22 '>
                                                </td> <td   align= 'right '   height= '22 '>
                                                        </td> </tr>
                                                        <---循环体>
                                                       
</table>


用datalist控件生成的都带个table,导致生面的属性框跟下面列出来的数据不能在一个表格里,很难看而且有时候对不齐!!谁有办法解决一下!!不胜感激!!!

  <table   id= "DataList1 "   cellspacing= "0 "   align= "center "   border= "0 "   style= "width:98%;border-collapse:collapse; ">
<tr>
<td>
    <tr   bgcolor= "#fafafa "   onMouseOver= "this.bgcolor   =   '#ebebeb ' "   onMouseOut= "this.bgcolor   =   '#fafafa ' ">
        <td   width= "10% "   height= "20 "   align= "center "> test </td>
        <td   width= "11% "   align= "center "> hndxdd </td>
        <td   width= "12% "   align= "center "> acc </td>


        <td   width= "12% "   align= "center "> dd </td>
        <td   width= "6% "   align= "center "> 锁定 <input   name= "Fettle "   type= "checkbox "   value=8   /> </td> <td   width= "5% "   align= "center "> <A   HREF= "# "   onclick= "topen( 'Ad.aspx?id=8&Action=Up_App ') "> <img   src= "../img/edit.gif "   width= "15 "   height= "15 "   border= "0 "> </A> </td>
<td   width= "6% "   align= "center "> <A   HREF= "Ad.aspx?id=8&Action=Del "   onclick= "var   a=confirm( '确定要删除吗? ');if(a==0)   return(false); "> <img   src= "../img/delete.gif "   width= "13 "   height= "13 "   border= "0 "> </A> </td>  
    </tr>
    </td>
</tr> <tr>
<td>
    <tr   bgcolor= "#fafafa "   onMouseOver= "this.bgcolor   =   '#ebebeb ' "   onMouseOut= "this.bgcolor   =   '#fafafa ' ">
        <td   width= "10% "   height= "20 "   align= "center "> ccxxx </td>
        <td   width= "11% "   align= "center "> hndxdd </td>
        <td   width= "12% "   align= "center "> ccc </td>
        <td   width= "12% "   align= "center "> xxx </td>
        <td   width= "6% "   align= "center "> 锁定 <input   name= "Fettle "   type= "checkbox "   value=7   /> </td> <td   width= "5% "   align= "center "> <A   HREF= "# "   onclick= "topen( 'Ad.aspx?id=7&Action=Up_App ') "> <img   src= "../img/edit.gif "   width= "15 "   height= "15 "   border= "0 "> </A> </td>
<td   width= "6% "   align= "center "> <A   HREF= "Ad.aspx?id=7&Action=Del "   onclick= "var   a=confirm( '确定要删除吗? ');if(a==0)   return(false); "> <img   src= "../img/delete.gif "   width= "13 "   height= "13 "   border= "0 "> </A> </td>  
    </tr>
    </td>
</tr> <tr>
<td>
    <tr   bgcolor= "#fafafa "   onMouseOver= "this.bgcolor   =   '#ebebeb ' "   onMouseOut= "this.bgcolor   =   '#fafafa ' ">
        <td   width= "10% "   height= "20 "   align= "center "> vvv </td>
        <td   width= "11% "   align= "center "> hndxdd </td>
        <td   width= "12% "   align= "center "> ff </td>
        <td   width= "12% "   align= "center "> sfg </td>
        <td   width= "6% "   align= "center "> 锁定 <input   name= "Fettle "   type= "checkbox "   value=6   /> </td> <td   width= "5% "   align= "center "> <A   HREF= "# "   onclick= "topen( 'Ad.aspx?id=6&Action=Up_App ') "> <img   src= "../img/edit.gif "   width= "15 "   height= "15 "   border= "0 "> </A> </td>


<td   width= "6% "   align= "center "> <A   HREF= "Ad.aspx?id=6&Action=Del "   onclick= "var   a=confirm( '确定要删除吗? ');if(a==0)   return(false); "> <img   src= "../img/delete.gif "   width= "13 "   height= "13 "   border= "0 "> </A> </td>  
    </tr>
    </td>
</tr> <tr>
<td>
    <tr   bgcolor= "#fafafa "   onMouseOver= "this.bgcolor   =   '#ebebeb ' "   onMouseOut= "this.bgcolor   =   '#fafafa ' ">
        <td   width= "10% "   height= "20 "   align= "center "> 测试112 </td>
        <td   width= "11% "   align= "center "> hndxdd </td>
        <td   width= "12% "   align= "center "> asfd </td>
        <td   width= "12% "   align= "center "> asdf </td>
        <td   width= "6% "   align= "center "> 锁定 <input   name= "Fettle "   type= "checkbox "   value=5   /> </td> <td   width= "5% "   align= "center "> <A   HREF= "# "   onclick= "topen( 'Ad.aspx?id=5&Action=Up_App ') "> <img   src= "../img/edit.gif "   width= "15 "   height= "15 "   border= "0 "> </A> </td>
<td   width= "6% "   align= "center "> <A   HREF= "Ad.aspx?id=5&Action=Del "   onclick= "var   a=confirm( '确定要删除吗? ');if(a==0)   return(false); "> <img   src= "../img/delete.gif "   width= "13 "   height= "13 "   border= "0 "> </A> </td>  
    </tr>
    </td>
</tr> <tr>
<td>
    <tr   bgcolor= "#fafafa "   onMouseOver= "this.bgcolor   =   '#ebebeb ' "   onMouseOut= "this.bgcolor   =   '#fafafa ' ">
        <td   width= "10% "   height= "20 "   align= "center "> 测试11 </td>
        <td   width= "11% "   align= "center "> hndxdd </td>
        <td   width= "12% "   align= "center "> 啊啊22 </td>
        <td   width= "12% "   align= "center "> 啊啊啊 </td>
        <td   width= "6% "   align= "center "> 正常 <input   name= "Fettle "   type= "checkbox "   value=3   /> </td> <td   width= "5% "   align= "center "> <A   HREF= "# "   onclick= "topen( 'Ad.aspx?id=3&Action=Up_App ') "> <img   src= "../img/edit.gif "   width= "15 "   height= "15 "   border= "0 "> </A> </td>
<td   width= "6% "   align= "center "> <A   HREF= "Ad.aspx?id=3&Action=Del "   onclick= "var   a=confirm( '确定要删除吗? ');if(a==0)   return(false); "> <img   src= "../img/delete.gif "   width= "13 "   height= "13 "   border= "0 "> </A> </td>  


    </tr>
    </td>
</tr>
</table>  

[解决办法]
别用datagrid
就自己写html.然后输出来。
[解决办法]
我都是这样做的。分页也简单啊` 一个分页方法,一个输出方法。
你可以不用response.write
就把这个变量赋给一个控件。控件可以位置嘛
[解决办法]
用repeater控件很灵活
[解决办法]
你要那样做,就用Repeater,所有html自己写。
[解决办法]
<asp:Repeater ID= "rp1 " runat= "server " OnItemCommand= "rp1_ItemCommand "> <HeaderTemplate> 头部html代码只显示一次 </HeaderTemplate> <ItemTemplate> 中间循环代码 <TR> <TD> <%Eval( "字段 ")%> </TD> </TR> </ItemTemplate> <FooterTemplate> 尾部html代码 只显示一次 </FooterTemplate> </asp:Repeater>
[解决办法]
Repeater控件最好

热点排行