Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/311.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# EntityDataSource具有GridView,其中解释_C#_Asp.net_Entity Framework - Fatal编程技术网

C# EntityDataSource具有GridView,其中解释

C# EntityDataSource具有GridView,其中解释,c#,asp.net,entity-framework,C#,Asp.net,Entity Framework,嗨,我使用带有EntityDataSource的GridView 我需要使用WHERE从EntityDataSource筛选数据。 筛选器应为当前登录的用户使用ProviderUserKey(在我的示例中为GUID数据类型) 目前,我使用此代码在页面加载事件中检索Guid Guid myActiveUser = (Guid)Membership.GetUser().ProviderUserKey; 如何将此变量传递到EntityDataSource“Where”进行过滤,并在我的GridVi

嗨,我使用带有EntityDataSource的GridView

我需要使用WHERE从EntityDataSource筛选数据。 筛选器应为当前登录的用户使用ProviderUserKey(在我的示例中为GUID数据类型)

目前,我使用此代码在页面加载事件中检索Guid

Guid myActiveUser = (Guid)Membership.GetUser().ProviderUserKey;
  • 如何将此变量传递到EntityDataSource“Where”进行过滤,并在我的GridView中显示结果
  • 这是正确的方法吗?还有其他解决办法吗

谢谢大家

尝试使用如下代码:

Guid myActiveUser = (Guid)Membership.GetUser().ProviderUserKey;    
EntityDataSource1.Where = "it.User = " + myActiveUser.ToString();