微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在内部或重新排序列表和面板中找到控件? ASP.NET

如何解决如何在内部或重新排序列表和面板中找到控件? 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;">
                                &nbsp;
                            </div>
                        </DragHandleTemplate>
                        <ReorderTemplate>
                            <div style="width: 99%; border: dashed 2px #999999;">
                                &nbsp;
                            </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 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?