linqdatasource

I am using linq datasource, how can i configure a where expression

RequestDate != @RequestDate = null Gives me an ERROR: The string was not recognized as a valid DateTime. There is a unknown word starting at index 0. ...

Linqdatasource and relational data problem

I have a problem with linqdatasource. I have gridview in my page and I set it's datasource to linqdatasource,also I set AllowPaging="True" , AllowSorting="True". <asp:GridView ID="cityGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="CityId" AllowPaging="True" AllowSorting="True" DataSourceID="LinqCityData"> Now in lin...

Get return value from SP when using LINQDatasource

Hi All, I have a Dynamic Data Website for edit, update and delete data. As we know, the dynamic data website uses LINQDatasource control for DB operations. For delete, i am using Stored Procedure instead of using default LINQ that returns a int on successfull delete. i have configured my LINQ to SQL class to use the stored procedure for...

Ordinal Position of Element in IENumerable Collection (Linq to XMl )

How do I embed the ordinal number of element as its attribute in this linq query. var AllSections = from s in xmlDoc.Descendants("section") select new { id = s.Attribute("id").Value, themeTitle = s.Element("themeTitle").Value, ...

Bitwise operators LinqDataSource Where

Hi, I have a byte column called 'Type' in my MS Server database. On my Asp.net page I have a ListView and a LinqDataSource. The 'Type' column is different enum flags. I would like to check specific bits in column 'Type' in my LinqDataSource Where property. I tried with: (Check first bit) Type == (Type | 1) Type = (Type | 1) Type | 1 ...

LINQ Outer Joins Dynamic OrderBy

In a Linq Statement like the following (narrowed down to relevant parts for the question): var sites = from s in DataContext.Sites join add in DataContext.Address on s.PrimaryAddress equals add into sa from a in sa.DefaultIfEmpty() select new { s.Id, ...

Linqdatasource group by problem with multiple table

I'm using linqdatasource for displaying data in listview (nested because of grouping) control. I want to display data from more than one table. I'm using VWDExpress. ...

Linq to SQL data source best practice

When using linq to SQL in my project I am currently creating the data context as late as possible in the code execution and disposing it as soon as possible. This results in the data context being open and closed many times on a page. Another option is to open the data class on page load and dispose it on page unload so the connection i...

LinqDataSource wizard table list is not refreshing after updating LinqToSql classes

I have changed my dbml file like this. I have deleted all the tables and stored procs. I added new tables and stored procs from a new database. In the code-behind, I can access the new tables and stored procs. However, in the LinqDataSource using the same dbContext when I'm trying to configure the LinqDataSource. I can see all the ol...

LinqDataSource does not support the Select property when the Delete, Insert or Update operations are enabled

Hello, I am getting this error when clicking the Delete button / link in a GridView control LinqDataSource [DataSource] does not support the Select property when the Delete, Insert or Update operations are enabled I don't really understand why I'm getting this error because I have already done the same thing on a different webpage in...

LinqDataSource - how do I select rows based on the current UserId?

Hello, I have a Grid View control that displays data based on what is returned by the LinqDataSource. The LinqDataSource selects data depending on the date chosen in a date control (used in the where clause), but I also need the where clause to be based on the current userID which is a GUID. How can I get the LinqDataSource to obtai...

Consolidated discussion: LinqDataSource or ObjectDataSource?

I've a moderate-scale web-app with an SQL-Server based backend DB. My DB overview - http://stackoverflow.com/questions/1667802/generic-suggestions-for-sql-2005-framework-design-and-implementation My App framework overview - http://stackoverflow.com/questions/1729199/l2s-linq-to-sql-or-ef-entity-framework So, for now as we'...

datasources and Eval in a gridview

I have a gridview using a linqdatasource with a datamodelcontext that I've created. Why is it that I can do this: <asp:TemplateField> <ItemTemplate> <asp:Label ID="Label3" runat="server" Text='<%# Eval("tblUserProfile.Phone") %>'> </asp:Label> </ItemTemplate> </asp:TemplateField> But this: <asp:BoundField Dat...

Better way of refreshing DataGridView.DataSource

Currently I have a DataGridView in my app which I fill from my Linq-to-SQL classes like so ... /// <summary> /// Delegate to update datagrid, fixes threading issue /// </summary> private void updateInfo() { // Linq to datagridview; display all var query = from n in dbh.Items select n; itemData...

How to programmatically wire up a LINQ dat source in ASP.Net?

myGridView.DataSource = LinqDataSource works but only for select. I have edit and delete columns and when I try to use them I get errors about events not getting caught. Specifically I've seen OnRowDeleting, but I'm sure there are others that need to be wired up. myGridView.OnRowDeleting = ?? I can't seem to find anything on the Linq...

Return Modified Fields in LinqDataSource

Hi Everyone, I have a LinqDataSource like this one : <asp:LinqDataSource ID="linqDSUsers" runat="server" ContextTypeName="Repository.BBDatabaseDataContext" Select="new (UserID,FirstName,LastName)" TableName="Users"> </asp:LinqDataSource> How can I convert it into this : <asp:LinqDataSource ID="linqDSUsers" runat="server...

linqdatasource: Databind from another project

I have a solution "Foo" with 2 projects. "FooCore" and "FooWeb" where FooCore peoject contains the FooDatacontext in namespace Foo.FooCore.Core.Domain . How can bind the datacontext with linqdatasource in FooWeb project in aspx page. Is this possible by doing "<% Import Namespace="Foo.FooCore.Core.Domain"%>" in that aspx page? I hope I a...

ASP.NET LinqDataSource WHERE clause

I need to make a WHERE clause for my LinqDataSource which depends on the currently logged in user. Of course, I have access to the currently logged in user in the code-behind and I specifically need the user ID to fetch only data belonging to him/her from the database. It works fine when I add the Where attribute to the <asp:LinqDataSou...

ASP.Net: Sorting, GridView BoundColumn vs. TemplateColumn

With everything else being equal, a BoundField column in an asp:GridView is sortable, but a TemplateField column is not. Why is that? <asp:LinqDataSource ID="someDataSource" runat="server" ContextTypeName="someDataContext" TableName="someTable" OnSelecting="someSelectingHandler" /> ...

Using a single GridView and a LinqDataSource, how would you update data from a parent table and a child table?

I'm using a GridView and a LinqDataSource to display data from an entity called CHILD in this example. CHILD has an association with the PARENT entity. I'm having no problems displaying data from both these entities in a single GridView since related PARENT records are exposed as a property in CHILD. However, I can't figure out a wa...