datagridtablestyle class

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Upon populating a DataGrid with an array object in a web app, I am unable to find the DataGridTableStyle class to instantiate a variable, and use it to modify the display format. Attempted updates show my vrsion of Visual Studio.NET us up-to-date. What should I do to make this class available for use?
 
Hello,

Based on my understanding, currently you want to use DataGridTableStyle in
ASP.NET web application and found this class is not usable, right?

In fact, DataGridTableStyle is for datagrid control in windows forms. It is
totally different than the datagrid web server control in ASP.NET
programming. In MSDN, we can find that DataGridTableStyle is in
windows.forms namespace. However, datagrid in asp.net web app is in
system.web.ui.webcontrols namespace.

In ASP.NET programming, if we want to change the style of table in
datagrid, we need to refer to DataGrid Web Server Control document at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/
vbcondatagridwebcontrol.asp

Also, the following is a good document on ASP.NET datagrid control
programming:
Top Questions About the DataGrid Web Server Control
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechar
t/html/vbtchtopquestionsaboutaspnetdatagridservercontrol.asp

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi,

Do you have any more concerns on how to set datagrid table style in web
form programming? I found some further information for you:
--------------------------------------
You can further customize the appearance of the DataGrid control by
programmatically adding attributes to the <td> and <tr> tags generated by
the DataGrid control. Attributes can be inserted into the tags by providing
a custom event handler for the ItemCreated or ItemDataBound event. In
general, attributes are added in the event handler for the ItemCreated
event. However, if the attributes depend on actual data, add the attributes
in the handler for the ItemDataBound event.

To add an attribute to the <td> tag, first get the TableCell object that
represents the cell in the DataGrid control to which you want to add the
attribute. The Control.Controls collection for the Item property
(DataGridItemEventArgs indexer) of the DataGridItemEventArgs passed into
the event handler can be used to get the desired TableCell. You can then
use the AttributeCollection.Add method of the Attributes collection for the
TableCell to add attributes to the <td> tag.

To add an attribute to the <tr> tag, first get the DataGridItem that
represents the row in the DataGrid control to which you want to add the
attribute. The Item property (DataGridItemEventArgs indexer) of the
DataGridItemEventArgs passed into the event handler can be used to get the
desired DataGridItem. You can then use the AttributeCollection.Add method
of the Attributes collection for the DataGridItem to add attributes to the
<tr> tag.
--------------------------------------

If there is anything unclear, please feel free to post here. Thanks very
much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top