Hi,
I am using XamGrid from v10.2. I am having issues when the data from a stored proc has columns with special characters(ex #, % etc). Such columns have no data shown on the grid. How do I resolve this issue?
Harish,
Do you mean that the column names have special characters?
Sincerely,FrancisDeveloper Support Engineer
Yes, the column names have special characters. I have query that says
Select EmpId, Emp_Name, Loan as 'Loan #', Total as 'Total %' from TestEmp
The output on Sql Server looks like this:
And on XamGrid as this:
When I see the raw data from using Fiddler, I see that the data is passed through correctly but disappears as it binds to the grid. Not sure what I am doing wrong here.
(1) You could try changing your query so that the column names/aliases do not have special characters that will screw up the binding:
Select EmpId, Emp_Name, Loan, Total as from TestEmp
(2) Then you can just set the column names manually in the xamWebGrid:
One or both of these ways should work:
<igGrid:TextColumn Key="Loan">
<igGrid:TextColumn.HeaderTemplate>
<DataTemplate>
<TextBlock Text="Loan #" />
</DataTemplate>
</igGrid:TextColumn.HeaderTemplate>
</igGrid:TextColumn>
<igGrid:TextColumn Key="Total">
<TextBlock Text="Total %" />
or
<igGrid:TextColumn Key="Loan" HeaderText="Loan #"/>
<igGrid:TextColumn Key="Total" HeaderText="Total %"/>
As a bit of an aside ...
.NET won't allow such characters as part of a property name, so I'm thinking you'd want to use names like LoanNumber or TotalPercentage instead. You would probably be better off assigning another property that represents the unit (%, $), which you could then bind to for display purposes.
The aliases you use in your query do not align to best practices, and they'll probably give you headaches in other types of applications (as they cannot be mapped to CLR datatypes), so I'd recommending stearing clear of that and sticking to conventions.
As far as the Infragistics stuff, I don't think I'd consider that a bug, but I think if you work with them you'll find it does what you need.
So to be clear are you binding to a collection of objects whose properties include these characters? Exactly what type of objects and collection are you binding to XamGrid? How are you getting that data into your Silverlight application?
Devin
I wish I could try this but the columns definitely need to have special characters imply the business meaning (ex % or $). Also, the I am invoking different stored procedures at runtime based on few conditions so cannot have a hardcoded HeaderTemplate. I hope this is not a bug with XamGrid. Any other solution would be most welcome.