EntityDataSource not working but SqlDataSource version does??
OK, so it is not quite the whole page that will not load, but the Ajax Tab area i have to display a couple different grid areas. I am improving an internal site for my company that contains a list of the employees along with the different Certs, Skills, etc they have. I inherited most of the code base and have been going through and updating what I can. With this updating i have been moving all the sqldatasource related stuff to entitydatasource. most of this has been going fine, except for one little EntityDataSource that does not want to play nice. I will post code for the relevant sections below and try to describe the problem as best I can.
Below is the sqlDataSource that works just fine:
<asp:SqlDataSource ID="ds_Skills_Filtered" runat="server" ConnectionString="<%$ ConnectionStrings:Skills_StageConnectionString %>"
SelectCommand="select skill_id, skill_nm from skills where skill_id not in (select skill_id from resource_skills where resource_id = @resource_id) order by skill_nm">
<SelectParameters>
<asp:ControlParameter ControlID="grd_Resource_Select" Name="resource_id" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>I have this connected to a DropDownList like so:
<asp:DropDownList ID="dd_skill" runat="server" DataSourceID="ds_Skills_Filtered" DataTextField="skill_nm"
DataValueField="skill_id" CssClass="InsertArea Middle3TabsInsertAreaWidth1">
</asp:DropDownList>
If I do this it works just fine and the Ajax tab area loads just fine. If i convert the SqlDataSource to an EntityDataSource then i can't for the life of me get the Ajax Tab area to load. The Entity version of the SqlDataSource i am using looks like this:<asp:EntityDataSource runat="server" ID="edsSkillsFiltered" ConnectionString="name=SkillsEntities"
DefaultContainerName="SkillsEntities" EntitySetName="Skills" Select="it.skill_id, it.skill_nm"
OrderBy="it.skill_nm" Where="it.skill_id NOT IN (SELECT VALUE r.skill_id FROM SkillsEntities.ResourceSkills AS r WHERE r.resource_id = @resource_id)">
<WhereParameters>
<asp:ControlParameter ControlID="grd_Resource_Select" DbType="Int32" Name="resource_id"
PropertyName="SelectedValue" />
</WhereParameters>
</asp:EntityDataSource>
Now, for a little more in depth description of what is happening:I have a main GridView (MGV) that displays all my people in the database. A logged in user can select and view other peoples information, but not change it obviously. If the user clicks on another persons name then an Ajax Tab area pops up with 5 tabs that each contain a GridView. The GridViews display the Certs, Skills, Roles, Skills and Personal Information for the selected person. This process works just fine whether i am using the SQL or Entity DataSource. The logged in user can also select there own name from the MGV and look at and edit there information. If i have the SqlDataSource hooked up to the DropDownList the Ajax Tab area loads just fine and the user can edit anything they like. If i switch the DropDownList to use the EntityDataSouce then i CAN NOT get the Ajax Tab area to load... at all. The above EntityDataSource is almost exactly like three others used for the Certs, Roles, and Products tabs. Esentially what i am trying to do with the Sql and Entity statements i have is filter out Skills that have already been added to the logged in users SkillsGrid so they cannot add it more than once. If someone has a better way of doing this please let me know!
If anyone needs any more information please let me know.
- Moved byYichun_FengMSFTWednesday, November 11, 2009 1:46 AMASP.NET issue (From:ADO.NET Entity Framework and LINQ to Entities)
All Replies
- Hi prostuff,
Since your question is related to ASP.NET, you can have better answer in Data Access and ObjectDataSource Control forum for ASP.NET,
http://forums.asp.net/23.aspx
Best Regards
Yichun Feng
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.


