CSS Set table width

Source: Internet
Author: User
CSS on!
You really don't have CSS? Then you should find the CSS information.
For example, your CSS file has the following content:
class1{width:20%;}
class2{width:30%;}

Then write your datagrid, you do not use it the default wording, will autogenrated (this word I forgot how to spell) set to False, and then bind themselves to the template inside the DataGrid, in each item inside set, God, I just looked at your post, This just understand that you are just using the original function of the DataGrid?
Look at the following wording:
<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
<ItemTemplate>
ItemTemplate HTML
</ItemTemplate>
<EditItemTemplate>
EditItem Template HTML
</EditItemTemplate>
<FooterTemplate>
Footer Template HTML
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
You can then specify a cssclass for each template, or set it directly inside, so you don't have to use CSS anymore.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.