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?
Gridview/detailsview with entitydatasourceusing ado.net entity framework
Page 1 of 1
8 Replies - 9787 Views - Last Post: 01 December 2009 - 02:25 PM
Replies To: Gridview/detailsview with entitydatasource
#2
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..
#3
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.
It can be done with sql
It can be done with access
I want to know how to do it using entity framework.
#4
Re: Gridview/detailsview with entitydatasource
Posted 29 November 2009 - 10:14 AM
#5
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
#6
Re: Gridview/detailsview with entitydatasource
Posted 30 November 2009 - 12:18 AM
#7
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.
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.
#8
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
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
#9
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.
Here is my source:
http://msdn.microsof...y/cc488531.aspx
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
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|