我正在努力在ASPX Web窗体页面中获取HTML文件上载控件。我使用了以下代码
<td class="ClientDetailTableLeftColumn">
<asp:Label ID="lblUpload" runat="server" Text="Upload File"></asp:Label>
</td>
<td "ClientDetailTableControls" colspan="2">
<p id="UploadArea">
<input id="FileUploadInput" type="file" size="20"/>
<asp:Button ID="btnUpload" runat="server" Text="Click To Upload" CssClass="btnFormSubmit" />
</p>
<input id="btnUploadMore" type="button" value="Add New Attachment" onclick="AddUploadBox" />
</td>
但是在本地IIS中运行时出现错误。
System.Web.UI.HtmlControls.HtmlTableCellCollection必须包含项目 键入System.Web.UI.HtmlControls.HtmlTableCell'。 'p'是类型 System.Web.UI.HtmlControls.HtmlGenericControl”。
代码在第二行失败:
Line 85: <td "ClientDetailTableControls" colspan="2">
Line 86: <p id="UploadArea">
请问有人可以帮我解决这个问题吗?或者为什么会失败?
答案 0 :(得分:0)
试试这个
<td class="ClientDetailTableLeftColumn">
<asp:Label ID="lblUpload" runat="server" Text="Upload File"></asp:Label>
</td>
<td "ClientDetailTableControls" colspan="2">
<div id="UploadArea">
<input id="FileUploadInput" type="file" size="20"/>
<asp:Button ID="btnUpload" runat="server" Text="Click To Upload" CssClass="btnFormSubmit" />
</div>
<input id="btnUploadMore" type="button" value="Add New Attachment" onclick="AddUploadBox" />
</td>