I currently have a DetailsView (used to be a Formview, but that is a nogo with Masterpage and ObjectDataSource).
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:"
<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, !."
<asp:ObjectDataSource ID="ods_InsertComment" runat="server" InsertMethod="InsertComment"
TypeName="OurClient.Host.CommentsBLL" SelectMethod="GetNothing">
<InsertPar开发者_开发技巧ameters>
<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. 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. I moved the DefaultMode="Insert"
out and the Item [] went grey (not clickable). As I said in the beginning - the DetailsView
is a solution instead of a FormView
.
Before you ask the GetNothing
is a requirement, it must have a SelectMethod
defined. Can't compile it unless it's there.
Solution: AutoGenerateRows="False"
on <asp:detailsview ....>
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. 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.
Check your code-behind file for any string like "InsertComment" or "dv_" or "_dv", etc. and have a look.
I'm only guessing off course.
精彩评论