簡體   English   中英

帶有GridView WHERE說明的EntityDataSource

[英]EntityDataSource with a GridView WHERE Explnation

嗨,我將GridView與EntityDataSource一起使用。

我需要使用WHERE從EntityDataSource過濾數據。 篩選器應為當前登錄用戶使用ProviderUserKey(在我的情況下為GUID數據類型)。

目前,我習慣在Page_Load事件中檢索此代碼

Guid myActiveUser = (Guid)Membership.GetUser().ProviderUserKey;
  • 如何將此變量傳遞給EntityDataSource“在哪里”以過濾並在GridView中顯示結果?
  • 這是正確的方法嗎? 還有其他解決方案嗎?

多謝你們!

嘗試使用如下代碼:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM