Filtering a gridview based on userName

Joined
Apr 3, 2010
Messages
2
Reaction score
0
Hi,

I am using a gridview with ado.net entity framework. I am trying to filter my gridview records by userName equal to logged in user. But I don't know how to do this.


In asp:EntityDataSource I should use the Where clause, have tried the following:

<asp:EntityDataSource ID="DocumentsDataSource1" runat="server"
ConnectionString="name=iWEntities1"
DefaultContainerName="iWEntities1" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" EntitySetName="GeneratedDocument"
EntityTypeFilter="GeneratedDocument"
Where="it.UserId = '<% Context.User.Identity.Name %>' ">
</asp:EntityDataSource>

didnt work.. also looked at the availabe where parameters such as ProfileParameter, Cookie param, etc.. dont see anything that would allow for getting the logged in user though. Any idea how to do this?

Thanks,
- R
 
Joined
Apr 3, 2010
Messages
2
Reaction score
0
grid view filter by userid

ah, got it.

I created a custom param and referenced the assembly as follows:

<WhereParameters>
<iwc:UserIdParam Name="userID" Type="String" />
</WhereParameters>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top