在Web窗体中使用c#将参数传递给用户控件 [英] Using c# in Web Forms to passing parameter to user control
本文介绍了在Web窗体中使用c#将参数传递给用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从apx页面,我试图显示集合中每个项目的用户控件,但是当尝试设置UserControl参数时,C#似乎被忽略了:
From an aspx page, I am trying to display a user control for each item in a collection, but the C# seems to be ignored when tryign to set the UserControl parameter:
<%foreach (Fetus item in this.pregnancy.Fetus) {%>
//this returns a GUID:
"<%= item.Id.ToString() %>"
//this does not work, returns the characters between "" like < %= item.Id.ToString()%>:
<uc1:AntepartumCTGChart runat="server" ID="AntepartumCTGChart" FetusId="<%= item.Id.ToString()%>" />
<% } %>
我希望这能奏效,这是怎么回事?
I would expect this to work, what's wrong?
推荐答案
查看全文