Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:38:17+00:00 2026-05-28T18:38:17+00:00

When I have a simple DataSet that has a table with simple column names

  • 0

When I have a simple DataSet that has a table with simple column names (i.e., no spaces or periods), code such as the following works just fine:

  DataGrid resultsGrid=...; // Actually defined in the XAML
  DataSet ds=...; // The is the DataSet that contains one table
  Binding binding = new Binding();

  resultsGrid.DataContext=ds.Tables[0];
  resultsGrid.SetBinding(DataGrid.ItemsSourceProperty, binding);

The DataGrid in the above example has the AutoGenerateColumns attribute set to True and properly populates its data from the table in the DataSet.

However, if my table has columns with names containing spaces / periods or other special characters, the automated binding seems to fail. I get errors such as:

System.Windows.Data Information: 20 : BindingExpression cannot
retrieve value due to missing information. BindingExpression:Path=My
Col. Name; DataItem=’DataRowView’ (HashCode=8146871); target element
is ‘TextBlock’ (Name=”); target property is ‘Text’ (type ‘String’)

Clearly, the auto-generated binding expression Path=My Col. Name is not valid. The entire path needs to be “quoted” so as to allow spaces and periods. Is there any way to stick with AutoGeneratedColumns for tables with more complex column names, or do I have to go all manual now?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:38:17+00:00Added an answer on May 28, 2026 at 6:38 pm

    You could try handling resultsGrid.AutoGeneratingColumns – or more preferably, do this just to the grid before the set gets databound – to replace or remove spaces or periods in the column names. You’d have to do this to both the grid and DataSet, though, so if your data gets edited and saved, this method would likely be far more hassle than it’s worth. The efficiency and feasibility of this depends heavily on your app’s structure and behavior, plus I have not tested it, so take it with a sizable grain of salt.

    As far as I have found (which admittedly isn’t a terribly broad domain), you’re pretty much stuck with this behavior. I’d suggest submitting a bug to Microsoft; it seems like this would be desirable behavior for AutoGenerateColumns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pictures table that has the following columns: PICTURE_ID int IDENTITY(1000,1) NOT
I have a simple select from a typed dataset: var productlist = from prds
I have simple win service, that executes few tasks periodically. How should I pass
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have a hypothetical set of data with 3 columns that has monthly profit
I have a web application that uses a fairly large table (millions of rows,
NOTE: This is the simple version of my previous question that SHOULD have been
I have a very simple application in c# it has a Microsoft SQL Server
I have a data set that has two tab delimited columns that I plot
I have an unbound XtraReport that has a subreport control which contains another report.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.