I use EF4, C # and MS membership provider. A EntityDataSource
I have a GridView with data source Web Control
I filter data EntityDataSource should be user, assume that these, like filters show currently connected using Application for MS Memebership Provider (Membership.GetUser ();).
Now I have any parameters EntityDataSource that I think can not inf will allow DOT (where in / automatically generated using a go provided parameter expression).
Do you have any ideas?
Please provide me a sample of code, thanks for your time! "Text" itemprop = "text">
After you
You can not force user to declare EntityDataSource directly in the markup as a declaration. But basically there are two functions:
The first is easy, but the code-back is required you can use a normal Markup: Code-Back:. The second method is a custom parameters to show an example of how Note: Example asp: parameter and its value is code-behind You can set the user to identify:
& lt; asp: EntityDataSource id = "MyEntityDataSource" runat = "server" ConnectionString = "name = MyContext" DefaultContainerName = "MyContext" EntitySetName = "MyObjectSet" AutoGenerateWhereClause = "false" where = "it.Username = @ username" in the & lt; WhereParameters & gt; & Lt; Asp: parameter name = "user name" type = "string" /> & Lt; / WhereParameters & gt; & Lt; / ASP: EntityDataSource & gt;
protected void Page_Load (object sender, EventArgs e) {MyEntityDataSource.WhereParameters [ "username"] DefaultValue = User.Identity .Name; }
asp: Based on SqlDataSource , but If you make sure that you
WhereParameters , instead of EntityDataSource
should work instead EntityDataSource parameters SqlDataSource Select.
Comments
Post a Comment