0

我有以下代码(.Aspx.cs),

StringBuilder strMarkup = new StringBuilder();
strMarkup.AppendFormat("<div id=" + "MyDiv" + "><table id= " + "sDetails" +      ">" +
"<tr><td><input id= " + "lblStudentName" + " type=" + "text" + " value = " + "StudentName" + "/> </td>" +
"<td> <input id= " + "dispStudentName" + " type=" + "text" + " value = {0}/> </td>" +
"</tr>" +
"<tr><td><input id= " + "lblCourseName" + " type=" + "text" + " value = " +  "StudentName" + "/> </td>" +
"<td> <input id= " + "dispCourseName" + " type=" + "text" + " value = {1}/> </td>" +
"</tr></table></div>", _studentName, _courseName);

我想将上述内容加载到 Ajax UpdatePanel 我的 .aspx 页面如下:

 <asp:UpdatePanel ID="UpdateDetails" runat="server">
    <ContentTemplate>
        <asp:Panel ID="StudentDetialsPanel" runat= "server">
        </asp:Panel>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID = "btnSubmit" EventName="" />
    </Triggers>
   </asp:UpdatePanel> 

提前致谢

4

1 回答 1

2

使用面板的InnerHtml属性来分配你必须面板的 htmlUpdatePanel

StudentDetialsPanel.InnerHtml = strMarkup.ToString();
于 2013-03-12T09:59:28.030 回答