物品标签盒从哪里来

本文关键字:标签 | 更新日期: 2023-09-27 17:58:12

我现在有一个DetailsView(以前是Formview,但那是一个带有Masterpage和ObjectDataSource的nogo)。

不知怎的,图形中有一个"项目[]"(tickbox),我在源代码中找不到。在"Komental:"之后和"Dato:"之前可以找到图形

                <asp:DetailsView ID="dv_InsertComment" runat="server" DefaultMode="Insert" DataSourceID="ods_InsertComment"
                    HeaderText="Kommentar:">
                    <Fields>
                        <asp:TemplateField HeaderText="Dato:">
                            <InsertItemTemplate>
                                <asp:Label ID="dNow" runat="server" Text='<%# DateTime.Now.ToShortDateString() %>'></asp:Label>
                            </InsertItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Konto" Visible="false">
                            <InsertItemTemplate>
                                <asp:TextBox ID="tbAccountIns" runat="server"></asp:TextBox>
                            </InsertItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Kommentar:">
                            <InsertItemTemplate>
                                <asp:TextBox ID="tbCommentIns" runat="server" Rows="3" Columns="50" TextMode="MultiLine"></asp:TextBox>
                            </InsertItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Status:">
                            <InsertItemTemplate>
                                <asp:DropDownList ID="StatusList" runat="server" DataSourceID="ods_StatusOptions"
                                    DataTextField="name">
                                </asp:DropDownList>
                            </InsertItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Fremnotering:">
                            <InsertItemTemplate>
                                <asp:DateBox ID="dFuture" runat="server" AllowNullDate="true" />
                            </InsertItemTemplate>
                        </asp:TemplateField>
                        <asp:ButtonField ButtonType="Button" Text="Indsæt kommentar" CommandName="Insert" />
                        <asp:ButtonField ButtonType="Button" Text="Annuller" CommandName="Cancel" />
                    </Fields>
                </asp:DetailsView>

除此之外,参数列表要求NewDate后面有一个"!"。阿卡要求:"员工,帐户,评论,类型,状态,新日期,!"

                <asp:ObjectDataSource ID="ods_InsertComment" runat="server" InsertMethod="InsertComment"
                    TypeName="OurClient.Host.CommentsBLL" SelectMethod="GetNothing">
                    <InsertParameters>
                        <asp:SessionParameter Name="employee" SessionField="employee" DbType="String" />
                        <asp:Parameter Name="Account" DbType="String" />
                        <asp:Parameter Name="Comment" DbType="String" />
                        <asp:Parameter Name="Type" DefaultValue="0" DbType="Int32" />
                        <asp:Parameter Name="Status" DbType="Int32" />
                        <asp:Parameter Name="NewDate" DbType="DateTime" />
                    </InsertParameters>
                </asp:ObjectDataSource>

我在想,如果我删除Item和tickbox,"!"参数也会消失。但如果它不在那里,我该如何删除它?

我删除了整个<Fields></Fields>,只是为了只剩下项[]。我将DefaultMode="Insert"移出,项目[]变灰(无法点击)。正如我在开头所说的,DetailsView是一个解决方案,而不是FormView

在您询问GetNothing是一个需求之前,它必须定义一个SelectMethod。除非它在那里,否则无法编译它。

解决方案:<asp:detailsview ....> 上的AutoGenerateRows="False"

我是怎么发现的?我转到有问题的aspx,改为Split视图,继续分析实际存在的控件。我有点被"自动生成"复选框绊倒了。

物品标签盒从哪里来

您搜索过代码隐藏文件吗?

也许复选框被注入了?

复选框的id是"ContentPlaceHolder2_dv_InsertComment_ctl01",它可以是一个动态添加的控件。

检查代码隐藏文件中是否有任何字符串,如"InsertComment"、"dv_"或"_dv"等,然后查看。

我只是在猜测。