Gridview EmptyDataText="No data" - how to add style to the text 'No data'
I have a gridview control in my C# program and have just added an 'EmptyDataText' control that (as you know) displays a message if no records were found. When I view this page in design, the开发者_JS百科 'No data found' text is in times new roman and no style. Is it possible to make this text Verdana and also centre the text rather than it being on the left?
Look forward to your reply!
You can also use EmptyDateTemplate in your gridview
<EmptyDataTemplate>
<label style="color:Red;font-weight:bold">No records found !</label>
</EmptyDataTemplate>
You can set EmptyDataRowStyle-CssClass attribute to the css class you want to use.
<asp:GridView EmptyDataRowStyle-CssClass="your-css-class" />
Here you have something: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.emptydatatext.aspx
Or you can try this:
EmptyDataText = <div style=\"width:100%;color:red;\">No data found </div>"
-> and adjusting the style you need.
精彩评论