我有一个 .ascx 控件。那是有几个 Html 表和 Div 部分 Runat = "Server"
代码如下所示,
<div id = "divpayinfo" runat = "server">
<%!-- Some Code Here --%>
<table style="width: 403px" runat = "server">
<tr>
<td style="width: 63px; height: 22px;">
test</td>
<td colspan="2" style="height: 22px">
<strong><span style="color: #ffffff">ผู้ขอกู้หลัก</span></strong></td>
</tr>
<tr>
<td style="width: 63px; height: 21px">
</td>
<td style="width: 180px; height: 21px">
<strong>วงเงิน</strong></td>
<td style="height: 21px">
<strong>ยอดคงค้าง</strong></td>
</tr>
<tr>
<td style="width: 63px">
1. เงินกู้เพื่อที่อยู่อาศัย</td>
<td style="width: 180px">
<asp:TextBox ID="b_txt_lh_loan_h_all" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_h_all'),document.getElementById('b_txt_lh_loan_h_all'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_h_all'),document.getElementById('b_txt_lh_loan_h_all'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_h_all'),document.getElementById('b_txt_lh_loan_h_all'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_h_all" runat="server"
Text="0"></asp:TextBox></td>
<td>
<asp:TextBox ID="b_txt_lh_loan_h_remain" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_h_remain'),document.getElementById('b_txt_lh_loan_h_remain'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_h_remain'),document.getElementById('b_txt_lh_loan_h_remain'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_h_remain'),document.getElementById('b_txt_lh_loan_h_remain'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_h_remain" runat="server"
Text="0"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 63px; height: 102px;">
2. เงินกู้เบิกเกินบัญชี</td>
<td style="width: 180px; height: 102px;">
<asp:TextBox ID="b_txt_lh_loan_a_all" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_a_all'),document.getElementById('b_txt_lh_loan_a_all'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_a_all'),document.getElementById('b_txt_lh_loan_a_all'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_a_all'),document.getElementById('b_txt_lh_loan_a_all'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_a_all" runat="server"
Text="0"></asp:TextBox></td>
<td style="height: 102px">
<asp:TextBox ID="b_txt_lh_loan_a_remain" runat="server" CssClass="box_nosize_right"
MaxLength="8" onchange="To_Set_Value(document.getElementById('d_txt_lh_loan_a_remain'),document.getElementById('b_txt_lh_loan_a_remain'))"
onfocus="To_Get_Value(document.getElementById('d_txt_lh_loan_a_remain'),document.getElementById('b_txt_lh_loan_a_remain'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_lh_loan_a_remain'),document.getElementById('b_txt_lh_loan_a_remain'))"
Text="0" Width="90px"></asp:TextBox><asp:TextBox ID="d_txt_lh_loan_a_remain" runat="server"
Text="0"></asp:TextBox></td>
</tr>
</table>
我正在服务器端对 DIV 和 HTML 表进行一些操作。所以我提到了服务器端。我将此控件作为 formusercontrolwebpart 上传到 Sharepoint。
问题是当我上传带有 runat="Server" 标记的表时,用户控件没有显示在 sharepoint 页面上......所以我复制了这个表并只用这个表创建另一个 ascx 并将它上传到 sharepoint 但这正在工作美好的。
我已经检查了我所有的用户控制代码并添加了 ASP.NET 应用程序。用户控件按预期工作没有问题。但只有当我使用 Sharepoint 页面添加时才会出现问题..
我找到了以下解决方案,
从每个 Div 部分中删除所有 runat = "server" 标记并将 runat = "server" 添加到表中,然后共享点页面正在工作。但我的问题是我在服务器端有很多使用 Div 标签的操作。所以我不能使用这个解决方案..
请告诉我专家..是否有sharepoint保护runat =“server”标签免受用户控制或与此相关的任何东西......提前谢谢你..
如果我添加以下代码行,那么我的用户控件显示不会呈现,
<asp:TableCell id="d_div_l2_row9" runat="server" style="display: none; vertical-align: middle;
text-align: center">
<asp:TextBox ID="b_txt_l2_comission" runat="server" CssClass="box_nosize_right" MaxLength="8"
onchange="To_Set_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
onfocus="To_Get_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
onmouseout="To_Set_Value(document.getElementById('d_txt_l2_comission'),document.getElementById('b_txt_l2_comission'))"
Text="0" Width="180px"></asp:TextBox><span style="display: none"><asp:TextBox ID="d_txt_l2_comission"
runat="server" Text="0"></asp:TextBox></span></asp:TableCell>