Set a DetailsView to show a specif row using a QueryString and an Inner Control with the same value
I use ASP.NET.
I have a DetailsView with DataSource to EntityDataSource. EntityDataSource has a WhereParameter connected to a control on the page.
I need add some logic to allow the DetailsView to Change Mode (from ReadOnly to Edit) and display the result for a specific row passed from a Query String.
To chang开发者_如何学Pythone to Edit Mode I use:
DetailsView.ChangeMode(DetailsViewMode.Edit);
But I'm not able to set the DetailsView to show up the row passed from my Query String.
I receive also an error:
A property with name 'CategoryId1' does not exist in metadata for entity type
It seems to me that EntityDataSource when has two CategoryId make some mess and it is not able to bind properly the DetailsView.
Any idea how to do it?
Here my actual code for the EntityDataSource.
<asp:EntityDataSource ID="uxEntityDataSourceSelectEditNode" runat="server" AutoGenerateWhereClause="True"
ConnectionString="name=xxx" DefaultContainerName="xxx"
EnableDelete="True" EnableFlattening="False" EnableUpdate="True" EntitySetName="CmsCategories"
Where="">
<WhereParameters>
<asp:ControlParameter ControlID="uxTreeView" Name="CategoryId" PropertyName="SelectedValue"
Type="Int32" />
// Problem here
<asp:QueryStringParameter DefaultValue="0" Name="CategoryId"
QueryStringField="test" />
</WhereParameters>
</asp:EntityDataSource>
精彩评论