TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
janderson
NA
2
0
Formating DataGrid columns using DataView as DataSource
Nov 3 2003 9:27 AM
(Sorry, I prevented replies in my prior post. This one should hopefully allow them) I'm relatively new to .NET programming, and windows programming in general, but have had over 5 years of experience with designing Unix C applications. Earlier today I was experimenting with the DataGrid control and ran into a roadblock that has had me banging my head against the desk for the last 12 hours. I've been searching the net for a solution, but have yet to find a definitive answer. I'm looking to perform many of these actions on a DataGrids display: * Customizing the grid Column layout via the TableStyles collection * Changing Column Sizing * Changing how null values are displayed. * Only display a few of the DataViews columns in the Grid The main problem I have, is that I'm using a DataView for my Grids DataSource. The main issue seems to be caused by the fact that when using a DataView object as the grids DataSource, no DataMember property is present. The lack of the DataMember value seems to prevent user generated TableStyle's to be used. Summary of the Steps I've performed (I can get code samples if needed when I return to work Monday): In Object Designer: * Created 2 SqlAdapters for 2 tables * Created a Typed DataSet to Contain the results from the Adapters * Created a DataView with a Table property set to DataSet's Table A * Created a DataGrid object with the DataSource=DataView Using the debugger I was able to determine that my grid's TableStyle Collection was empty and used the defaultTableStyle Collection to control the way the DataView's columns are displayed. Then I added the following code to the Form_Load Event procedure to generate a new Style to use: * Following filling the DataSet with the Adapter: * Created a new TableStyle Item * Added to the Style's GridColumnStyles Collection a new DataGridTextBoxColumn for each column. * Added the new Style to the Grid's TableStyle Collection I have been unable to get the new TableStyle to be used for formatting and displaying my DataView items. The reason may be due to the values being used for the Style's MappingName property, but I have yet to find the right value to use. (DataView name, View’s Table name, empty string) If you have had any experience with using DataViews in DataGrids and know of how to do this, any information would be greatly appreciated. Regards, Jeremy
Reply
Answers (
0
)
Formating DataGrid columns using DataView as DataSource
MailMessage and Message Queue