8 Replies - 13424 Views - Last Post: 01 December 2009 - 02:25 PM Rate Topic: -----

#1 kstr  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 60
  • Joined: 19-October 09

Gridview/detailsview with entitydatasource

Post icon  Posted 29 November 2009 - 09:52 AM

I'm trying to get a Gridview/detailsview working but when using accessdatasource, i can specify a custom sql statement using the values in the gridview. With entitydatasource it seems inpossible...


How is it done with the entity framework?
Is This A Good Question/Topic? 0
  • +

Replies To: Gridview/detailsview with entitydatasource

#2 ramesh866  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 91
  • Joined: 03-October 09

Re: Gridview/detailsview with entitydatasource

Posted 29 November 2009 - 10:04 AM

i dont know about access db.. but with sql db , it can be done..
Was This Post Helpful? 0
  • +
  • -

#3 kstr  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 60
  • Joined: 19-October 09

Re: Gridview/detailsview with entitydatasource

Posted 29 November 2009 - 10:07 AM

Maybe i wasn't clear enough (sorry about that)

It can be done with sql
It can be done with access

I want to know how to do it using entity framework.
Was This Post Helpful? 0
  • +
  • -

#4 ramesh866  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 91
  • Joined: 03-October 09

Re: Gridview/detailsview with entitydatasource

Posted 29 November 2009 - 10:14 AM

check this
http://www.packtpub....ntity-framework
Was This Post Helpful? 0
  • +
  • -

#5 kstr  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 60
  • Joined: 19-October 09

Re: Gridview/detailsview with entitydatasource

Posted 29 November 2009 - 11:02 AM

What i'm trying to to is select a record from the gridview, then edit/insert it in the detailsview
Was This Post Helpful? 0
  • +
  • -

#6 ronaldjames  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 42
  • Joined: 29-June 09

Re: Gridview/detailsview with entitydatasource

Posted 30 November 2009 - 12:18 AM

View Postkstr, on 30 Nov, 2009 - 12:02 AM, said:

What i'm trying to to is select a record from the gridview, then edit/insert it in the detailsview


so can you tell which datasource you are going to use
Was This Post Helpful? 0
  • +
  • -

#7 ronaldjames  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 42
  • Joined: 29-June 09

Re: Gridview/detailsview with entitydatasource

Posted 30 November 2009 - 12:42 AM

So i will explain you how to select data using Gridview or Detailsview assuming that you are using the sql server database which comes with Microsoft Visual Studio 2008.

After creating the sql database and providing sufficient values to retrieve follow these steps.

1. Go to the Toolbar, drag and drop the Gridview.

2. Click on the Smart tag which is in the top right corner of the Gridview control.

3. Select <new data source> from the listbox shown there.

4. Now Select --> database ( for sql database) and specify an ID for datasource.

5. Now you specify which data connection you want to connect to using the listbox provided.

6. Now specify a name for the connection string.

7. Now select the database then the columns you want to show.

I think you are clear.
Was This Post Helpful? 0
  • +
  • -

#8 kstr  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 60
  • Joined: 19-October 09

Re: Gridview/detailsview with entitydatasource

Posted 30 November 2009 - 03:22 AM

Thank you for your reply. What i want to do is use the ado.net entity framework. so the datasource is EntityDataSource.

As i said, i can make it work with sql and access, but not with entity

This post has been edited by kstr: 30 November 2009 - 03:22 AM

Was This Post Helpful? 0
  • +
  • -

#9 gaotter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-December 09

Re: Gridview/detailsview with entitydatasource

Posted 01 December 2009 - 02:25 PM

Hi I hade the same problem looks like there are some new ways of doing stuff. Here is some code that that worked for me:

The code is in the second datasource where you what to do the selection.


<asp:EntityDataSource ID="EntityDataSource2" runat="server" 
			ConnectionString="name=AdventureWorksEntities" 
			DefaultContainerName="AdventureWorksEntities" EnableInsert="True" 
			EnableUpdate="True" EntitySetName="Employee" EntityTypeFilter="Employee"
			 Select="" Where="it.EmployeeID = @selEmpID">
			<WhereParameters>
			<asp:ControlParameter ControlID="GridView1" Name="selEmpID" Type="Int32" PropertyName="SelectedValue" />
			</WhereParameters>
		</asp:EntityDataSource> 


Here is my source:
http://msdn.microsof...y/cc488531.aspx
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1