I'm trying to create a member page for updating account details. I want to populate a form with the member's data, but I don't know how to set a filter on the EntityDataSource to limit the query.
When I set the select statement based on the member ID, I get the error
Select cannot be set if EnableDelete, EnableInsert, or EnableUpdate is enabled.
I think this is because you can't update a projection or something, but is there anyway around this?
Or do I have to run a query in Page_Load and populate the form myself?
There is no need to set the select, only the where clause.
You could do something like the following:
<asp:EntityDataSource ID="MyDataSource" EntitySetName="Entity1" runat="server"
ConnectionString="name=MyEntitiesConnString" EnableUpdate="true"
DefaultContainerName="MyEntities" Where="it.MemberId= @MemberId" >
<WhereParameters>
<asp:QueryStringParameter DbType="Int32" Name="memberId" QueryStringField="memberid" />
</WhereParameters>
</asp:EntityDataSource>
If the parameter is passed in by querystring. there are several other built-int parameter types as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With