This is a migrated thread and some comments may be shown as answers.

Problem with views and bit datatypes

2 Answers 94 Views
LINQ (LINQ specific questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kennith
Top achievements
Rank 1
Kennith asked on 19 Jun 2009, 02:10 PM
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:
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?

2 Answers, 1 is accepted

Sort by
0
Kennith
Top achievements
Rank 1
answered on 19 Jun 2009, 03:02 PM
Crap, I just realized I posted this in the wrong thread. Sorry.
0
Thomas
Telerik team
answered on 19 Jun 2009, 04:56 PM
Hello Kennith,

Yes, this forum is about OpenAccess, not about radGrid or Linq2Sql. Please report your question in the appropriate forum again!

Greetings,
Thomas
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
LINQ (LINQ specific questions)
Asked by
Kennith
Top achievements
Rank 1
Answers by
Kennith
Top achievements
Rank 1
Thomas
Telerik team
Share this question
or