css设定表格宽度

来源:互联网 发布:免费刷cf点软件 编辑:程序博客网 时间:2024/05/23 11:47
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
靠!
你真的不会css?那你先找一下css的资料吧。
比如你的css文件里面有以下内容:
Class1{width:20%;}
Class2{width:30%;}

然后写你的DataGrid,你不要使用它默认的写法,将AutoGenrated(这个单词我忘了怎么拼了)设置为false,然后自己绑定到DataGrid里面的模板里面,在每一项里面设置,老天,我刚才又看了一下你的贴子,这才明白,你只是使用的DataGrid的原始功能呀?
看看下面的写法:
<asp:DataGrid id="programmaticID" runat=server
   DataSource='<%# DataBindingExpression %>'
   AutoGenerateColumns="False"
   (other properties)>

   <Columns>
      <asp:BoundColumn
         DataField="DataSourceField"
         DataFormatString="FormatString"
         FooterText="FooterText"
         HeaderImageUrl="url"
         HeaderText="HeaderText"
         ReadOnly="True|False"
         SortField="DataSourceFieldToSortBy"
         Visible="True|False"
         FooterStyle-property="value"
         HeaderStyle-property="value"
         ItemStyle-property="value"
      />

      <asp:ButtonColumn
         ButtonType="LinkButton|PushButton"
         Command="BubbleText"
         DataTextField="DataSourceField"
         DataTextFormatString="FormatString"
         FooterText="FooterText"
         HeaderImageUrl="url"
         HeaderText="HeaderText"
         ReadOnly="True|False"
         SortField="DataSourceFieldToSortBy"
         Text="ButtonCaption"
         Visible="True|False"
      />

      <asp:EditCommandColumn
         ButtonType="LinkButton|PushButton"
         CancelText="CancelButtonCaption"
         EditText="EditButtonCaption"
         FooterText="FooterText"
         HeaderImageUrl="url"
         HeaderText="HeaderText"
         ReadOnly="True|False"
         SortField="DataSourceFieldToSortBy"
         UpdateText="UpdateButtonCaption"
         Visible="True|False"
        />

      <asp:HyperLinkColumn
         DataNavigateUrlField="DataSourceField"
         DataNavigateUrlFormatString="FormatExpression"
         DataTextField="DataSourceField"
         DataTextFormatString="FormatExpression"
         FooterText="FooterText"
         HeaderImageUrl="url"
         HeaderText="HeaderText"
         NavigateUrl="url"
         ReadOnly="True|False"
         SortField="DataSourceFieldToSortBy"
         Target="window"
         Text="HyperLinkText"
         Visible="True|False"
       />

      <asp:TemplateColumn>
         FooterText="FooterText"
         HeaderImageUrl="url"
         HeaderText="HeaderText"
         ReadOnly="True|False"
         SortField="DataSourceFieldToSortBy"
         Visible="True|False"
         <HeaderTemplate>
             Header template HTML
         </HeaderTemplate >
         <ItemTemplate>
             ItemTemplate HTML
         </ItemTemplate>
         <EditItemTemplate>
             EditItem template HTML
         </EditItemTemplate>
         <FooterTemplate>
             Footer template HTML
         </FooterTemplate>
      </asp:TemplateColumn>
    </Columns>
</asp:DataGrid>
然后你可以为每一个模板指定一个cssClass了,或者直接在里面设置,就不必再使用C

css设定表格宽度';return true">
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>