如何解决如何在内部或重新排序列表和面板中找到控件? ASP.NET
嗨,在此功能中,我使用了ReorderList。我有一个“编辑”链接按钮,该按钮显示一个带有文本框的面板,允许我编辑“重新订购列表”中的一项。在文本框所在的“重新排序列表”和“面板”中定位控件时遇到问题。简而言之,我想选择一个项目上的“编辑”链接,然后它将弹出面板,其中包含我选择的项目中的文本。打开后,我要编辑文本并将其保存到“重新排序列表”和“数据库”中。
```<div style="color: Black" class="ajaxOrderedList">
<ajaxToolkit:ReorderList runat="server" ID="ReorderList1" DataSourceID="sqlComments" DataKeyField="RecNo" SortOrderField="CommentOrder" AllowReorder="true" PostBackOnReorder="true">
<ItemTemplate>
<div style="border:1px solid black; padding:5px 0px 5px 5px;">
Program <asp:Label ID="lblProgram" runat="server" Text='<%# Eval("ProgramNumber")%>'></asp:Label>:
<asp:Label ID="lblComment" runat="server" Text='<%# Eval("Comment")%>'></asp:Label>
<asp:LinkButton runat="server" ID="lnkEditComment" Text="Edit" OnClick="lnkEditComment_Click"></asp:LinkButton>
<ajaxToolkit:ModalPopupExtender ID="modalPopup" runat="server" PopupControlID="pnlCommentInfo" TargetControlID="lnkEditComment" BackgroundCssClass="modalBackground" CancelControlID="btnCancel"></ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="pnlCommentInfo" runat="server" Style="display: none; text-align: left" CssClass="pnlPop" BorderStyle="Double" Width="500px" ScrollBars="Auto">
<asp:Label runat="server" ID="lblCommentNumber"></asp:Label><br />
<br />
Comment:<br />
<asp:TextBox ID="txtEditComment" runat="server" Rows="6" TextMode="MultiLine" Columns="58" /><br />
<br />
<asp:Button ID="btnSave" runat="server" Text="Save" CausesValidation="false" CommandName="Update" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" CausesValidation="false" />
</asp:Panel>
<asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton> </div>
</ItemTemplate>
<DragHandleTemplate>
<div style="width: 15px; height: 16px; background-image: url(images/icons/drag.png); background-repeat: no-repeat; cursor: move; border: outset thin white; padding: 2px; background-position: center;">
</div>
</DragHandleTemplate>
<ReorderTemplate>
<div style="width: 99%; border: dashed 2px #999999;">
</div>
</ReorderTemplate>
</ajaxToolkit:ReorderList>
</div>
</asp:Panel>```
这是我的代码背后:
{
//Add code to copy the current comment from the reorderedlist to the Edit Popup Box
TextBox newEdit = (TextBox)ReorderList1.FindControl("_rliInsert").FindControl("txtEditComment");
Label progr = (Label)ReorderList1.FindControl("_rliInsert").FindControl("lblProgram");
Label curComment = (Label)ReorderList1.FindControl("_rliInsert").FindControl("lblComment");
newEdit.Text = "Program " + progr.Text + ": " + curComment.Text;
}```
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。