我有一个.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”标签上传表时,usercontrol没有显示在sharepoint页面...所以我复制了这个表并仅使用此表创建另一个ascx并将其上传到sharepoint但是这工作正常。
我检查了所有用户控制代码并添加了ASP.NET应用程序。用户控件正在按预期工作没有问题。但只有当我添加Sharepoint页面时才会出现问题..
我找到了以下解决方案,
从每个Div部分删除所有runat =“server”标记,并将runat =“server”添加到表中,然后sharepoint页面正在运行。但是我的问题是我在服务器端有很多带有Div标签的操作。所以我不能使用这个解决方案..
请告诉我专家..无论如何,sharepoint保护runat =“server”标签来自usercontrol或与之相关的任何东西......谢谢你提前..
如果我添加了以下代码行,那么我的用户控件显示不会呈现,
<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>
答案 0 :(得分:0)
我认为asp:panel会转换为底层HTML中的div。你可以尝试一下;
<asp:panel id="divpayinfo" runat="server">
<!-- Your code here -->
</asp:panel>
答案 1 :(得分:0)
<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>
文本显示:样式中的无是由您生成或添加的。因为这意味着不应该显示控件。
答案 2 :(得分:0)
穆斯,安德鲁和香蕉,
非常感谢你帮助我的努力。
我找到了另一种方法来实现解决方案,但我仍然很难找到原因。
我在sharepoint服务器“control template”文件夹中上传了相同的usercontrol,我为该用户控件创建了一个.aspx页面,并在sharepoint中上传了aspx。现在它正好像使用asp.net应用程序一样工作。