我是.NET的新手,所以我很苦惱。我有一個內容頁面,帶有一箇中繼器控制。我有一個字典,這是一個Dictionary<string, Dictionary<int,[object]>>
。我想中繼器控件中的值從對象屬性得到它 - 候選人姓名,將是object.CandName
,候選人的手機將是object.Phone
等用字典<string,Dictionary <int,[object]綁定直放站>
我不知道如何使用Eval
這種類型的詞典。大多數例子指向Eval("Value")
,但它並沒有爲我提供正確的價值。請幫助!
<asp:Content ID="Content2" ContentPlaceHolderID="content" Runat="Server">
<div id="rcontent">
<table>
<tr>
<td>
<asp:Label ID="lblerror" runat="server" Text="" Visible="true" CssClass="alert"></asp:Label>
</td>
</tr>
</table>
<div id ="rptdiv">
<asp:Repeater ID="Repeater1" runat="server" EnableViewState="false">
<ItemTemplate>
<div id="Div3">
<table class="GridViewStyleNoBorder" width=750px cellspacing="0" border="0" >
<tr>
<td class="PagerStyle" colspan="4">
<asp:Label ID="lblName" Runat="server"
Text='<%= Need the value of the [object].objectproperty from dictionary here %>' />
</td>
</tr>
</table>
</div>
這是我Page_Load
後面的代碼 - BLDecision
是我的業務層的代碼,返回字典和詞典值是否正確。我在調試模式下檢查它們。
代碼背後:
Dictionary(int, Dictionary(int, InterviewFeedback)) ;
CandIntDetails = new Dictionary(int, Dictionary(int, InterviewFeedback))();
BLDecision objBLDecision = new BLDecision();
int ReqCategoryID = 0;
if (Request.QueryString["ReqCategoryID"] != null)
ReqCategoryID = int.Parse(Request.QueryString["ReqCategoryID"].ToString());
CandIntDetails = objBLDecision.GetCandidatesforReqCategory(ReqCategoryID);
Repeater1.DataSource = CandIntDetails;
Repeater1.DataBind();
我應該從代碼隱藏使用,我不能做的aspx頁面Eval('<% ....%>')
?
在此先感謝您的幫助。
您應該更準確地描述數據的格式。在某一時刻,你會說它是一個'Dictionary>',另一方面,你暗示你正在使用'Dictionary >'。字典包含什麼,你想要你的輸出看起來像什麼?你希望按字典鍵分組的東西,還是想要訪問特定鍵的所有值? –
Jacob
2012-02-04 21:49:34
它是:Dictionary(int,Dictionary(int,InterviewFeedback)); 我想要訪問並顯示特定鍵的所有值 - 每行都需要訪問和顯示所有值。 – 2012-02-05 10:10:44