[英]Where does the Item tickbox come from
I currently have a DetailsView (used to be a Formview, but that is a nogo with Masterpage and ObjectDataSource).我目前有一个DetailsView(曾经是一个Formview,但它是一个带有Masterpage 和ObjectDataSource 的nogo)。
Somehow there is an "Item [ ]" (tickbox) in the graphics that I can't find in the source.不知何故,我在源代码中找不到图形中的“项目 []”(复选框)。 It is graphically found after the "Kommentar:" and before the "Dato:"
它在“Kommentar:”之后和“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>
Ontop of that the parameter list requires a "."除此之外,参数列表需要一个“。” after NewDate: Aka it requires, "employee, Account, Comment, Type, Status, NewDate. !."
在 NewDate 之后:又名它需要“员工、帐户、评论、类型、状态、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>
I'm thinking if I remove the Item and tickbox, the "."我在想如果我删除项目和复选框,“。” parameter will go away too?
参数go 也会掉吗? But if it is not there how do I remove it?
但如果它不存在,我该如何删除它?
I have removed the entire <Fields></Fields>
just to have only the Item [] remaining.我已经删除了整个
<Fields></Fields>
只是为了只剩下 Item [] 。 I moved the DefaultMode="Insert"
out and the Item [] went grey (not clickable).我将
DefaultMode="Insert"
移出,并且 Item [] 变灰(不可点击)。 As I said in the beginning - the DetailsView
is a solution instead of a FormView
.正如我在开头所说的那样 -
DetailsView
是一种解决方案,而不是FormView
。
Before you ask the GetNothing
is a requirement, it must have a SelectMethod
defined.在您询问
GetNothing
是一项要求之前,它必须定义一个SelectMethod
。 Can't compile it unless it's there.除非它在那里,否则无法编译它。
Solution: AutoGenerateRows="False"
on <asp:detailsview....>
解决方案:
<asp:detailsview....>
上的AutoGenerateRows="False"
How did I spot that one?我是怎么发现那个的? I went to the aspx in question, changed to the Split view and continued to analyse what controls were actually present.
我转到有问题的 aspx,更改为拆分视图并继续分析实际存在的控件。 I kinda stumbled over the Auto Generate checkbox.
我有点偶然发现了自动生成复选框。
Have you searched the code-behind file?您是否搜索过代码隐藏文件?
Maybe the checkbox is injected?也许复选框被注入?
The id of the checkbox is "ContentPlaceHolder2_dv_InsertComment_ctl01", that could be a control which was added dynamically.复选框的 id 是“ContentPlaceHolder2_dv_InsertComment_ctl01”,它可以是动态添加的控件。
Check your code-behind file for any string like "InsertComment" or "dv_" or "_dv", etc. and have a look.检查您的代码隐藏文件中是否有任何字符串,例如“InsertComment”或“dv_”或“_dv”等,然后查看。
I'm only guessing off course.我只是在猜测。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.