DataSource Controls :: LinqDataSource And EntityDataSource?

Jun 12, 2010

I'v been using SqlDataSource and ObjectDataSource for a while.I would like to know about LinqDataSource and EntityDataSource. Therefore I have 2 questions to ask.1) Why do we need to use those twos? 2) In which cirmustances (Requirements) developers are using LinqDataSource and EntityDataSource?

View 1 Replies


Similar Messages:

DataSource Controls :: How To Convert The ESQL For EntityDatasource

Mar 11, 2011

T-SQL

[Code]....

And i want to convert to eSQL for EntityDatasource

[Code]....

But it is error.

View 1 Replies

DataSource Controls :: Passing A Value From ListView To EntityDataSource?

Jan 24, 2011

I have this code, and I need the "it.MembershipOption.Id" value in the "where" clause to be the <%# Eval("Id") %> from ListViewEventsOuter. I tried to add the Eval in the "where" clause but it throws an error.


How is this done?

[code]...

View 1 Replies

DataSource Controls :: Extending The EntityDataSource Control?

Mar 15, 2010

What would be the best way to extend the EntityDataSource control? I have a site that implements Entity Framework and I current create my model container and add it to the HTTPCurrent context. When I create EntityDataSource controls on the page I have to go into the code behind and set the OnContextCreating to add MY context to the EntityDataSource instead of the one that EntityDataSource creates. This is because in my model I have extended the Partial Classes to support Validation and custom Save/Delete methods.I would ideally like to create a custom control that I can drop onto a page that has its context already set to the context that I created.

View 1 Replies

DataSource Controls :: EntityDataSource Filtering / ESQL Where Clause?

Feb 28, 2010

I have a GridView that's currently bound to an ObjectDataSource. I would like to see if it's possible to instead bind it to an EntityDataSource. However, I need to be able to apply custom filters to it.

One of the filters corresponds to a bit / boolean property in the database / EntityDataModel. It has 3 possible selections:

[Code]....

[code]....

How can I accomplish the same thing in an eSQL Where clause? There is no COALESCE function, is there an equivalent?

View 1 Replies

DataSource Controls :: EntityDataSource With Include For Related Columns

Feb 28, 2011

I have a formview with an entityDataSource. I need to include columns from related fields. I have seen many demos, with AdventureWorksDB, that imply that you can do this by using INCLUDE in the entitydatasource declaration. I have tried made many attempts and it just does not seem to work as demonstrated. I have attached the errors below and the EDS. I have also attached a JPEG of the model I am working in. Three errors demonstrating 3 different attempts to include a related table:

DataBinding: 'TmModel.tbICObjectBase' does not contain a property with the name 'Group'
the code declaration for error 1:
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Group") %>' />
DataBinding: 'TmModel.tbICObjectBase' does not contain a property with the name 'tbICTagBase'.
the code declaration for error 2:
<asp:Label ID="Label1" runat="server" Text='<%# Bind("tbICTagBase.Group") %>' />
DataBinding: 'System.Data.Objects.DataClasses.EntityCollection`1[[TmModel.tbICTagBase, TmModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' does not contain a property with the name 'Group'.
the code declaration for error 3:
<asp:Label ID="tbICTagBasesLabel" runat="server" Text='<%# Bind("tbICTagBases.Group") %>' />
EntityDataSource
<asp:EntityDataSource ID="entDSObjectBase" runat="server" AutoGenerateWhereClause="True"
ConnectionString="name=IntouchDBContainer" Include="tbICTagBases"
DefaultContainerName="IntouchDBContainer" EnableFlattening="False"
EntitySetName="tbICObjectBases" EnableDelete="True" EnableInsert="True"
EnableUpdate="True" EntityTypeFilter="tbICObjectBase">
<WhereParameters>
<asp:SessionParameter SessionField="Tag" Name="RecID" Type="Int64" />
</WhereParameters>
</asp:EntityDataSource>

You can see the model at [URL] Or [URL]

View 3 Replies

DataSource Controls :: OrderBy Parameter Type In EntityDataSource?

Feb 26, 2010

I'm playing with an EntityDataSource and specifying a simple order by clause containing one column name, for instance "it.[DNS_NAME]".

When I run the following:

[Code]....

I get an EntitySqlException saying that @sort's type is incorrect. It is expecting a Transient.rowtype that matches one of the columns. What is going on here? Order by parameters don't really have a meaningful type other than a string in my opinion. When I try specifying DbType.String instead of TypeCode.String, the same error is thrown.

The exception:

'@sort' is not a member of type 'Transient.rowtype[(SOFTWARE_DSPL_ID,Edm.Int32(Nullable=True,DefaultValue=)),(COMPUTER_NAME,Edm.String(Nullable=True,DefaultValue=,MaxLength=64,Unicode=True,FixedLength=False)),(DNS_NAME,Edm.String(Nullable=True,DefaultValue=,MaxLength=64,Unicode=True,FixedLength=False)),(DIRECTORATE_NAME,Edm.String(Nullable=True,DefaultValue=,MaxLength=24,Unicode=True,FixedLength=False)),(OS_BROAD_CAT_NAM,Edm.String(Nullable=True,DefaultValue=,MaxLength=25,Unicode=True,FixedLength=False)),(OS,Edm.String(Nullable=True,DefaultValue=,MaxLength=64,Unicode=True,FixedLength=False)),(EQP_TYPE,Edm.String(Nullable=True,DefaultValue=,MaxLength=64,Unicode=True,FixedLength=False)),(EQP_PROP_NO,Edm.String(Nullable=True,DefaultValue=,MaxLength=10,Unicode=True,FixedLength=False))]'
in the currently loaded schemas.

How can I dynamically provide the column name to order by?

View 9 Replies

DataSource Controls :: LinqDataSource?

Jun 11, 2010

Im trying to build a where clause in c# for a LinqDataSource, but I cant get it to work, heres my code

[Code]....

when I set category to 'Concerts' tyhe where clause is

'Category = Concerts'

this generates an error telling me there is no column called 'Concerts'. I assume I somehow have to enclose the search term in quotes, Ive tried single and double quotes, but nothing works.

View 5 Replies

DataSource Controls :: Using LIKE In A Linqdatasource?

Nov 16, 2010

So I need to take the literal "SELECT....FROM Bay....WHERE Warehouse=1 and ((BAY LIKE '1.0%' or BAY LIKE '2.0%'))I have set up a linqdatasource on my asp page and I want to bind that to a gridview. Here is the start of the HTML:

<asp:LinqDataSource
ID="dsBays"
runat="server"
ContextTypeName="CartonInventory.CartonInventoryDataContext"
EnableUpdate="True"

[code]...

How do I add a parameter so that it includes the LIKE statement?

View 1 Replies

DataSource Controls :: EntityDataSource Throw Exception When Update With Self-Reference?

Nov 3, 2010

For a Table A defined in the DB like this:

A :{ id, selfId, name,} where selfId is a foreign key refered to Table A itself.

I generated the Entity automatically like this:

A :{ string id; A self; string name,} when i update the entity in gridview Edit/Update CommandField

i got the exception:

Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error:

[Code]....

Stack Trace:

[Code]....

I guess maybe this is caused by:

A is to be updated, and when the EntityDataSource construct the new A, the reference "self" is invalid at that moment. I do not want to modify my DB structure and do not want to lose the self reference, The event EntityDataSource_Updating is not triggered while the exception hit. so i can not access my entity at any time. Maybe the worst idea is deal the whole Update Procedure myself. However, is there any better workaround?

View 3 Replies

DataSource Controls :: Using Linqdatasource And Datagrid?

Mar 12, 2010

i am an asp.net beginner, i am a windows application programmer and currently i am working on big project " Human Resources" and i need to allow the users to apply for jobs using a web page.in windows application, i can use the bindingsource to bind textboxes and comboboxes to the fields of an object from L2S.and to bind the datagrid also to the detailed data and the page will be for inserting issue only,i.e i don't need to bring the data of applicants and certificates from the database, i just need some lookup data like maritalstatusCombo and availableJobsList things to allow the user to choose from.how can i do this using linqdatasource.

View 3 Replies

DataSource Controls :: Getting E.OldValues While Using LinqDataSource?

Mar 11, 2010

I use LinqDataSource and GridView.

I need an old value of field "PictureBig" in RowUpdating handler like this:

e.OldValues["PictureBig"]

To achieve this I use bound unvisible literal in edit item template...

<asp:Literal ID="ltBig" runat="server" Text='<%# Bind("PictureBig") %>' Visible="false" />

Is there any better ways of doing this?

View 5 Replies

DataSource Controls :: LINQDataSource Multiple WhereParameter?

Mar 23, 2011

I am trying to program the where prameters for this in code behind in C#, and is there really no way to do more than one parameter? Or am I not understanding this correctly? It seems only the 2nd parameter gets executed, no matter which one is at begining. I debug and seems they both get executed fine, but my listview doesn't get filtered and instead only the 2nd paramter works. Look at my code:

Also, if I do myLinq.Where = "division ==1 and someotherInt = 2", it works fine, but if I do two different data types, it will throw error. Since I want to filter with two different data types, hwo do I do this?

Parameter pram1 = new Parameter();
pram1.Name = "division";
pram1.DbType = DbType.Int32;

[code]...

View 20 Replies

DataSource Controls :: Multiple Inserts With LinqDataSource?

Sep 4, 2010

I'm having a question about the LinqDataSource. Does anyone know if it's possible to perform multiple inserts with the LinqDataSource? Let's say for example that I have 2 tables.

Table A
AID = PK autoincrement Name AddressA FK AddressB FK
Table B
BID = PK autoincrementStreetNumberPostalCodeCountry

These tables are just examples to clarify my question. Let's say that I have a FormView with a LinqDataSource where the user can enter his name en a billing address (A) en delivery address (B). Now I would like to know if the LinqDataSource is able to insert 2 records in table B and use these ID's to insert them in table A together with the name?

View 2 Replies

DataSource Controls :: How To LinqDataSource Date Parameters

Jun 15, 2010

I need to retrieve data using a date as an input parameter. I created a WhereParameter and passed in a date value that I know to exist in the database, but no data is returned. Heres my code

[Code]....

Ive passed in '02/06/2010' as the date, in the database, the Startdate column has several values of '2010-06-02 13:08:50.503' so I guess its not being found because of the time part. Whats the best way to make sure that I retrieve the correct data ? Im not concerned about the time at all, I just need all rows for 02/06/2010.

View 3 Replies

DataSource Controls :: Get Data From A LinqDataSource From Code Behind?

Nov 18, 2010

If I have a Linqdatasource that isn't connected to a a bound control on my page how do I use the data source to read data in the code behind. ie

var query = (from x in linqdatasource select x)

What I actually want to do is create a data array (myArray) within the code, read all of the data from the linqdatasource (selecting 1 field to form tableDataArray), then compare the two arrays and then write (insert) those into in myArray that are not already in the datasource to the datasource (ie execute an insert back on the datasource).

View 1 Replies

DataSource Controls :: LinqDataSource.Select Syntax?

Jan 14, 2010

Where can I find documentation on the syntax that is expected for LinqDataSource.Select? It seems to be different from what I would do with Linq inline in C# code. For example, concatenateing something in Linq I would normally just do this in the projection:

new { FullName = (person.FirstName + " " + person.LastName ) }
However, with a LinqDataSource the only way I've found to do this is like this:
new ( String.Concat(person.FirstName, " ", person.LastName) as FullName)

I literally spent hours trying to figure this out, and only succeeded when I found a blog where someone gave this verbatim as an example. So I still don't understand why the syntax is different, the braces versus parens, aliasing, Concat operators. Next time I do this I want a better understanding so I am not playing this guessing game. It's like being handed a compiler, and trying to write a program when you don't know what language the compiler compiles.1. Are there different "flavors" of Linq? Like a VB Linq, and C# Linq?2. If so, is the LinqDataSource using a VB flavor of Linq?3. Really, what is really important to me, where can I find documentation on this particular falvor of Linq that the LinqDataSource expects? The documentation for the LinqDataSource itself gives nothing more than extremely simplistic examples.

View 1 Replies

DataSource Controls :: Getting Value From LinqDataSource In FormView DataBound Event?

Mar 16, 2010

I just started working with LinqDataSources and I was wondering how you retrieve values in a FormView DataBound Event.

With an ObjectDataSource I believe you can grab them like:

[Code]....

Is there a similar way to acheive this with a LinqDataSource?

View 4 Replies

DataSource Controls :: Programmatically Add An Updateable Formview With Linqdatasource?

Aug 7, 2010

I have a gridview on a page and based on the row selected I need to fill out a form view (dynamic data enabled) from a linqdatasource. On gridview_sleectedindexchanged I create the linqdatasource and set it as the datasource for the formview. It displays nicely but clicking update returns a "Could not determine a MetaTable" error for the datasource mapped.

THe goal is to create a single page that allows users to select a row then get the appropriate data, create an updateable formview so further edits can be done. Do not want to scaffold.

View 3 Replies

DataSource Controls :: Refresh LinqDataSource From Ascx.vb Code?

Nov 15, 2010

I have LinqDataSource ID="LinqDataSource1" with values - EnableDelete="True", EnableInsert="True" EnableUpdate="True" on my ascx page, furthermore GridView, button a few textboxes, where a fill new values, which I would like save in my database. After click on button I insert new value to the table throught in function stored in ascx.vb page. It is works, but I don't know, how I refresh GridView on ascx page. I tried

LinqDataSource1.DataBind()
GridView1.DataBind()

without any good result, I must refresh page manualy (F5).

View 4 Replies

DataSource Controls :: Linqdatasource Update In Gridview-Only First Row Updated?

Oct 21, 2010

have detailsview

<asp:DetailsView
ID="dtlviewRecommendation" DataSourceID="LinqDataSourceRecommendation"
DataKeyNames="PK_TT_RecommendationsSysId">

[code]...

View 1 Replies

DataSource Controls :: LinqDataSource - GridView Filtering With DropDownList?

Jul 28, 2010

[Code]....

i am using gridview control and a linqdatasource and its all working fine and i have added the functionlity of searchingBySubject and i added WhereParameters and than binding my gridview (see the code below) but somehow its not returning any rows and i see i have number of rows based on what i am searching.

View 11 Replies

DataSource Controls :: Bind The Results From SQLDataSource To LinqDataSource?

Apr 21, 2010

Is it possible to assign the SQLDataSource.Select results to the LinqDataSource results ?

View 1 Replies

DataSource Controls :: Querying Across Associations With Listview And Linqdatasource?

Feb 12, 2010

With the gridview I can create a template field to query across associations but I don't see how its possible to do that with the listview (?). I tried to create associations in the eval fields

(ie productId.Brand) where productId is in the Reviews table and is associated with the Products table - and Brand is a member of the Product table but it was no go?

[Code]....

<b>Title:</b> <%# Eval("Title") %>

View 4 Replies

DataSource Controls :: Retrieve The Data In Linqdatasource In Code Behind?

Jul 30, 2010

How can i retrieve the data in linqdatasource in code behind?i have a dynamic database design with column storing the datatype eg. text, int, date.i need to retrieve the value in order to populate the control and bind it.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved