This question is locked. New answers and comments are not allowed.
I have a view with around 10 bits, 2 ints, and 1 string field.
If I create this manually using an anonymous type then everything seems to work fine when I databind it (e.g. datasource = foo);
If I create this in a view and drpo the view in a LinqToSql data context then the RadGridView doesn't interpret it was a bit but instead as a string when I do an inline query.
Here is an example of the code which does not work:
Here is an example of the code which does work:
Strangely, I have other views with bits and it works just fine. Seemingly just two new views I made here recently.
The only changed properties on the RadGridView is the 'AllowAddNewRow' and 'AllowDeleteRow' properties are set to 'false'. Even though these are set like they are, I can't seem to edit anything that is databound.
I've also tried doing this so I could peek at the data:
They really are boolean values. I can edit the mto be true/false and anything else isn't accepted.
I've also tried setting the DataType on each of the appropriate columns to be: DataType = typeof(bool) however that didn't seem to help or change anything whatsoever.
For code cleanliness, I'd rather avoid an anonymous type since a view does just as good but in a single line of code.
Any thoughts on what I'm doing wrong or where I could start looking?
If I create this manually using an anonymous type then everything seems to work fine when I databind it (e.g. datasource = foo);
If I create this in a view and drpo the view in a LinqToSql data context then the RadGridView doesn't interpret it was a bit but instead as a string when I do an inline query.
Here is an example of the code which does not work:
| this.radGridViewToolSecurityGrid.DataSource = from t in databaseContext.vwSecurityUserToolLists select t; |
Here is an example of the code which does work:
| var toolList = (from sg in databaseContext.SecurityGroups |
| join tools in databaseContext.NavigatorToolSecurities on sg.SecurityGroupID equals tools.SecurityGroupID into g |
| from tools in g.DefaultIfEmpty() |
| orderby sg.SecurityGroupName |
| select new |
| { |
| sg.SecurityGroupID, |
| NavigatorToolSecurityID = tools.NavigatorToolSecurityID == null ? 0 : tools.NavigatorToolSecurityID, |
| sg.SecurityGroupName, |
| Activity101MassEntryEnabled = tools.Activity101MassEntryEnabled == null ? false : tools.Activity101MassEntryEnabled, |
| ActivityMilestoneBatchEntryEnabled = tools.ActivityMilestoneBatchEntryEnabled == null ? false : tools.ActivityMilestoneBatchEntryEnabled, |
| AdministerKioskIssuesEnabled = tools.AdministerKioskIssuesEnabled == null ? false : tools.AdministerKioskIssuesEnabled, |
| AdministerKiosksEnabled = tools.AdministerKiosksEnabled == null ? false : tools.AdministerKiosksEnabled, |
| AdministerKioskThemesEnabled = tools.AdministerKioskThemesEnabled == null ? false : tools.AdministerKioskThemesEnabled, |
| MergeByHouseholdEnabled = tools.MergeByHouseholdEnabled == null ? false : tools.MergeByHouseholdEnabled, |
| MergePersonsEnabled = tools.MergePersonsEnabled == null ? false : tools.MergePersonsEnabled, |
| MinistryGroupMemberCopyEnabled = tools.MinistryGroupMemberCopyEnabled == null ? false : tools.MinistryGroupMemberCopyEnabled, |
| SmallGroupInquiryEnabled = tools.SmallGroupInquiryEnabled == null ? false : tools.SmallGroupInquiryEnabled, |
| SmallGroupLeadershipEnabled = tools.SmallGroupLeadershipEnabled == null ? false : tools.SmallGroupLeadershipEnabled |
| }).ToList(); |
| this.radGridViewToolSecurityGrid.DataSource = toolList; |
Strangely, I have other views with bits and it works just fine. Seemingly just two new views I made here recently.
The only changed properties on the RadGridView is the 'AllowAddNewRow' and 'AllowDeleteRow' properties are set to 'false'. Even though these are set like they are, I can't seem to edit anything that is databound.
I've also tried doing this so I could peek at the data:
| List<vwSecurityUserToolList> toolList = (from t in databaseContext.vwSecurityUserToolLists select t).ToList(); |
They really are boolean values. I can edit the mto be true/false and anything else isn't accepted.
I've also tried setting the DataType on each of the appropriate columns to be: DataType = typeof(bool) however that didn't seem to help or change anything whatsoever.
For code cleanliness, I'd rather avoid an anonymous type since a view does just as good but in a single line of code.
Any thoughts on what I'm doing wrong or where I could start looking?