我是.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