D
David C
I have a ListView bound to an SQL table but it never goes into Edit mode nor
does the Insert button add any records. I have looked at it for hours and
cannot see anything. Below is most of the page. Can someone please help?
Thanks.
David
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Width="800"></asp:TextBox>
<asp:TextBox ID="txtRecordID" runat="server"
Text="22631"></asp:TextBox>
<asp:ListView ID="lvRepairOrderNotes" runat="server"
DataKeyNames="NotesID"
DataSourceID="SqlRepairOrderNotes" Visible="True">
<ItemTemplate>
<tr style="background-color:#DCDCDC;color: #000000;">
<td><asp:Label ID="LblActivityDate" runat="server"
Text='<%# Eval("ActivityDate", "{0:M/d/yyyy h:mm tt}") %>' />
</td>
<td><asp:Label ID="LblActivityType" runat="server"
Text='<%# Eval("ActivityType") %>' />
</td>
<td><asp:Label ID="LblActivityNotes" runat="server"
Text='<%# Eval("ActivityNotes") %>' />
</td>
<td><asp:Label ID="LblEnteredBy" runat="server"
Text='<%# Eval("EnteredBy") %>' />
</td>
<td><asp:Label ID="LblFollowupDate" runat="server"
Text='<%# Eval("FollowupDate", "{0:d}") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' CssClass="Hide" />
</td>
<td><asp:Label ID="LblRecordID" runat="server" Text='<%#
Eval("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:LinkButton ID="LBtnEdit" runat="server"
CommandName="Edit" Text="Edit" />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color:#FFF8DC;">
<td><asp:Label ID="LblActivityDate" runat="server"
Text='<%# Eval("ActivityDate", "{0:M/d/yyyy h:mm tt}") %>' />
</td>
<td><asp:Label ID="LblActivityType" runat="server"
Text='<%# Eval("ActivityType") %>' />
</td>
<td><asp:Label ID="LblActivityNotes" runat="server"
Text='<%# Eval("ActivityNotes") %>' />
</td>
<td><asp:Label ID="LblEnteredBy" runat="server"
Text='<%# Eval("EnteredBy") %>' />
</td>
<td><asp:Label ID="LblFollowupDate" runat="server"
Text='<%# Eval("FollowupDate", "{0:d}") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' CssClass="Hide" />
</td>
<td><asp:Label ID="LblRecordID" runat="server" Text='<%#
Eval("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:LinkButton ID="LBtnEditAlt" runat="server"
CommandName="Edit" Text="Edit" />
</td>
</tr>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table runat="server"
style="background-color: #FFFFFF;border-collapse:
collapse;border-color: #999999;
border-style:none;border-width:1px;">
<tr>
<td>No Repair Notes found.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td><asp:TextBox ID="txtActivityDate" runat="server"
Text='<%# Bind("ActivityDate", "{0:M/d/yyyy h:mm tt}") %>' />
</td>
<td><asp:TextBox ID="txtActivityType" runat="server"
Text='<%# Bind("ActivityType") %>' />
</td>
<td><asp:TextBox ID="txtActivityNotes" runat="server"
Text='<%# Bind("ActivityNotes") %>' />
</td>
<td><asp:TextBox ID="txtEnteredBy" runat="server"
Text='<%# Bind("EnteredBy") %>' />
</td>
<td><asp:TextBox ID="txtFollowupDate" runat="server"
Text='<%# Bind("FollowupDate") %>' />
</td>
<td> </td>
<td><asp:TextBox ID="txtRecordID" runat="server"
Text='<%# Bind("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:Button ID="InsertButton" runat="server"
CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server"
CommandName="Cancel" Text="Clear" /></td>
</tr>
</InsertItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer"
runat="server" border="1"
style="background-color:
#FFFFFF;border-collapse: collapse;border-color:
#999999;border-style:none;border-width:1px;font-family: Verdana, Arial,
Helvetica, sans-serif;">
<tr runat="server"
style="background-color:#DCDCDC;color: #000000;">
<th runat="server">
ActivityDate</th>
<th runat="server">
ActivityType</th>
<th runat="server">
ActivityNotes</th>
<th runat="server">
EnteredBy</th>
<th runat="server">
FollowupDate</th>
<th runat="server">
</th>
<th runat="server">
</th>
<th runat="server">
</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server"
style="text-align: center;background-color:
#CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
</td>
</tr>
</table>
</LayoutTemplate>
<EditItemTemplate>
<tr style="background-color:#008A8C;color: #FFFFFF;">
<td><asp:TextBox ID="txtActivityDate" runat="server"
Text='<%# Bind("ActivityDate") %>' />
</td>
<td><asp:TextBox ID="txtActivityType" runat="server"
Text='<%# Bind("ActivityType") %>' />
</td>
<td><asp:TextBox ID="txtActivityNotes" runat="server"
Text='<%# Bind("ActivityNotes") %>' />
</td>
<td><asp:TextBox ID="txtEnteredBy" runat="server"
Text='<%# Bind("EnteredBy") %>' />
</td>
<td><asp:TextBox ID="txtFollowupDate" runat="server"
Text='<%# Bind("FollowupDate") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' CssClass="Hide" />
</td>
<td><asp:TextBox ID="txtRecordID" runat="server"
Text='<%# Bind("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:LinkButton ID="LBtnUpdateNote" runat="server"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="LBtnCancelNote" runat="server"
CommandName="Cancel" Text="Cancel" />
</td>
</tr>
</EditItemTemplate>
<SelectedItemTemplate>
<tr style="background-color:#008A8C;font-weight: bold;color:
#FFFFFF;">
<td><asp:Label ID="LblActivityDate" runat="server"
Text='<%# Eval("ActivityDate") %>' />
</td>
<td><asp:Label ID="LblActivityType" runat="server"
Text='<%# Eval("ActivityType") %>' />
</td>
<td><asp:Label ID="LblActivityNotes" runat="server"
Text='<%# Eval("ActivityNotes") %>' />
</td>
<td><asp:Label ID="LblEnteredBy" runat="server"
Text='<%# Eval("EnteredBy") %>' />
</td>
<td><asp:Label ID="LblFollowupDate" runat="server"
Text='<%# Eval("FollowupDate", "{0:d}") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' />
</td>
<td><asp:Label ID="LblRecordID" runat="server" Text='<%#
Eval("RecordID") %>' />
</td>
<td><asp:LinkButton ID="LBtnEdit" runat="server"
CommandName="Edit" Text="Edit" />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlRepairOrderNotes" runat="server"
ConnectionString="<%$ ConnectionStrings:MgmtConnectionString %>"
ProviderName="<%$
ConnectionStrings:MgmtConnectionString.ProviderName %>"
DeleteCommand="DELETE FROM [RepairOrderNotes] WHERE [NotesID] =
@NotesID"
InsertCommand="INSERT INTO [RepairOrderNotes] ([RecordID],
[ActivityDate], [ActivityType], [ActivityNotes], [EnteredBy],
[FollowupDate]) VALUES (@txtRecordID, @ActivityDate, @ActivityType,
@ActivityNotes, @EnteredBy, @FollowupDate)"
SelectCommand="SELECT [NotesID], [RecordID], [ActivityDate],
[ActivityType], [ActivityNotes], [EnteredBy], [FollowupDate] FROM
[RepairOrderNotes] WHERE ([RecordID]=@txtRecordID) ORDER BY [ActivityDate]
DESC"
UpdateCommand="UPDATE [RepairOrderNotes] SET [ActivityDate] =
@ActivityDate, [ActivityType] = @ActivityType, [ActivityNotes] =
@ActivityNotes, [EnteredBy] = @EnteredBy, [FollowupDate] = @FollowupDate
WHERE [NotesID] = @NotesID">
<SelectParameters>
<asp:ControlParameter ControlID="txtRecordID"
Name="txtRecordID" PropertyName="Text" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp
arameter Name="NotesID" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:ControlParameter ControlID="txtRecordID"
Name="txtRecordID" PropertyName="Text" Type="Int32" />
<asp
arameter Name="ActivityDate" Type="DateTime" />
<asp
arameter Name="ActivityType" Type="String" />
<asp
arameter Name="ActivityNotes" Type="String" />
<asp
arameter Name="EnteredBy" Type="String" />
<asp
arameter Name="FollowupDate" Type="DateTime" />
</InsertParameters>
<UpdateParameters>
<asp
arameter Name="ActivityDate" Type="DateTime" />
<asp
arameter Name="ActivityType" Type="String" />
<asp
arameter Name="ActivityNotes" Type="String" />
<asp
arameter Name="EnteredBy" />
<asp
arameter Name="FollowupDate" Type="DateTime" />
<asp
arameter Name="NotesID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
does the Insert button add any records. I have looked at it for hours and
cannot see anything. Below is most of the page. Can someone please help?
Thanks.
David
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Width="800"></asp:TextBox>
<asp:TextBox ID="txtRecordID" runat="server"
Text="22631"></asp:TextBox>
<asp:ListView ID="lvRepairOrderNotes" runat="server"
DataKeyNames="NotesID"
DataSourceID="SqlRepairOrderNotes" Visible="True">
<ItemTemplate>
<tr style="background-color:#DCDCDC;color: #000000;">
<td><asp:Label ID="LblActivityDate" runat="server"
Text='<%# Eval("ActivityDate", "{0:M/d/yyyy h:mm tt}") %>' />
</td>
<td><asp:Label ID="LblActivityType" runat="server"
Text='<%# Eval("ActivityType") %>' />
</td>
<td><asp:Label ID="LblActivityNotes" runat="server"
Text='<%# Eval("ActivityNotes") %>' />
</td>
<td><asp:Label ID="LblEnteredBy" runat="server"
Text='<%# Eval("EnteredBy") %>' />
</td>
<td><asp:Label ID="LblFollowupDate" runat="server"
Text='<%# Eval("FollowupDate", "{0:d}") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' CssClass="Hide" />
</td>
<td><asp:Label ID="LblRecordID" runat="server" Text='<%#
Eval("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:LinkButton ID="LBtnEdit" runat="server"
CommandName="Edit" Text="Edit" />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color:#FFF8DC;">
<td><asp:Label ID="LblActivityDate" runat="server"
Text='<%# Eval("ActivityDate", "{0:M/d/yyyy h:mm tt}") %>' />
</td>
<td><asp:Label ID="LblActivityType" runat="server"
Text='<%# Eval("ActivityType") %>' />
</td>
<td><asp:Label ID="LblActivityNotes" runat="server"
Text='<%# Eval("ActivityNotes") %>' />
</td>
<td><asp:Label ID="LblEnteredBy" runat="server"
Text='<%# Eval("EnteredBy") %>' />
</td>
<td><asp:Label ID="LblFollowupDate" runat="server"
Text='<%# Eval("FollowupDate", "{0:d}") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' CssClass="Hide" />
</td>
<td><asp:Label ID="LblRecordID" runat="server" Text='<%#
Eval("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:LinkButton ID="LBtnEditAlt" runat="server"
CommandName="Edit" Text="Edit" />
</td>
</tr>
</AlternatingItemTemplate>
<EmptyDataTemplate>
<table runat="server"
style="background-color: #FFFFFF;border-collapse:
collapse;border-color: #999999;
border-style:none;border-width:1px;">
<tr>
<td>No Repair Notes found.</td>
</tr>
</table>
</EmptyDataTemplate>
<InsertItemTemplate>
<tr style="">
<td><asp:TextBox ID="txtActivityDate" runat="server"
Text='<%# Bind("ActivityDate", "{0:M/d/yyyy h:mm tt}") %>' />
</td>
<td><asp:TextBox ID="txtActivityType" runat="server"
Text='<%# Bind("ActivityType") %>' />
</td>
<td><asp:TextBox ID="txtActivityNotes" runat="server"
Text='<%# Bind("ActivityNotes") %>' />
</td>
<td><asp:TextBox ID="txtEnteredBy" runat="server"
Text='<%# Bind("EnteredBy") %>' />
</td>
<td><asp:TextBox ID="txtFollowupDate" runat="server"
Text='<%# Bind("FollowupDate") %>' />
</td>
<td> </td>
<td><asp:TextBox ID="txtRecordID" runat="server"
Text='<%# Bind("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:Button ID="InsertButton" runat="server"
CommandName="Insert" Text="Insert" />
<asp:Button ID="CancelButton" runat="server"
CommandName="Cancel" Text="Clear" /></td>
</tr>
</InsertItemTemplate>
<LayoutTemplate>
<table runat="server">
<tr runat="server">
<td runat="server">
<table ID="itemPlaceholderContainer"
runat="server" border="1"
style="background-color:
#FFFFFF;border-collapse: collapse;border-color:
#999999;border-style:none;border-width:1px;font-family: Verdana, Arial,
Helvetica, sans-serif;">
<tr runat="server"
style="background-color:#DCDCDC;color: #000000;">
<th runat="server">
ActivityDate</th>
<th runat="server">
ActivityType</th>
<th runat="server">
ActivityNotes</th>
<th runat="server">
EnteredBy</th>
<th runat="server">
FollowupDate</th>
<th runat="server">
</th>
<th runat="server">
</th>
<th runat="server">
</th>
</tr>
<tr ID="itemPlaceholder" runat="server">
</tr>
</table>
</td>
</tr>
<tr runat="server">
<td runat="server"
style="text-align: center;background-color:
#CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
</td>
</tr>
</table>
</LayoutTemplate>
<EditItemTemplate>
<tr style="background-color:#008A8C;color: #FFFFFF;">
<td><asp:TextBox ID="txtActivityDate" runat="server"
Text='<%# Bind("ActivityDate") %>' />
</td>
<td><asp:TextBox ID="txtActivityType" runat="server"
Text='<%# Bind("ActivityType") %>' />
</td>
<td><asp:TextBox ID="txtActivityNotes" runat="server"
Text='<%# Bind("ActivityNotes") %>' />
</td>
<td><asp:TextBox ID="txtEnteredBy" runat="server"
Text='<%# Bind("EnteredBy") %>' />
</td>
<td><asp:TextBox ID="txtFollowupDate" runat="server"
Text='<%# Bind("FollowupDate") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' CssClass="Hide" />
</td>
<td><asp:TextBox ID="txtRecordID" runat="server"
Text='<%# Bind("RecordID") %>' CssClass="Hide" />
</td>
<td><asp:LinkButton ID="LBtnUpdateNote" runat="server"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="LBtnCancelNote" runat="server"
CommandName="Cancel" Text="Cancel" />
</td>
</tr>
</EditItemTemplate>
<SelectedItemTemplate>
<tr style="background-color:#008A8C;font-weight: bold;color:
#FFFFFF;">
<td><asp:Label ID="LblActivityDate" runat="server"
Text='<%# Eval("ActivityDate") %>' />
</td>
<td><asp:Label ID="LblActivityType" runat="server"
Text='<%# Eval("ActivityType") %>' />
</td>
<td><asp:Label ID="LblActivityNotes" runat="server"
Text='<%# Eval("ActivityNotes") %>' />
</td>
<td><asp:Label ID="LblEnteredBy" runat="server"
Text='<%# Eval("EnteredBy") %>' />
</td>
<td><asp:Label ID="LblFollowupDate" runat="server"
Text='<%# Eval("FollowupDate", "{0:d}") %>' />
</td>
<td><asp:Label ID="LblNotesID" runat="server" Text='<%#
Eval("NotesID") %>' />
</td>
<td><asp:Label ID="LblRecordID" runat="server" Text='<%#
Eval("RecordID") %>' />
</td>
<td><asp:LinkButton ID="LBtnEdit" runat="server"
CommandName="Edit" Text="Edit" />
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
<asp:SqlDataSource ID="SqlRepairOrderNotes" runat="server"
ConnectionString="<%$ ConnectionStrings:MgmtConnectionString %>"
ProviderName="<%$
ConnectionStrings:MgmtConnectionString.ProviderName %>"
DeleteCommand="DELETE FROM [RepairOrderNotes] WHERE [NotesID] =
@NotesID"
InsertCommand="INSERT INTO [RepairOrderNotes] ([RecordID],
[ActivityDate], [ActivityType], [ActivityNotes], [EnteredBy],
[FollowupDate]) VALUES (@txtRecordID, @ActivityDate, @ActivityType,
@ActivityNotes, @EnteredBy, @FollowupDate)"
SelectCommand="SELECT [NotesID], [RecordID], [ActivityDate],
[ActivityType], [ActivityNotes], [EnteredBy], [FollowupDate] FROM
[RepairOrderNotes] WHERE ([RecordID]=@txtRecordID) ORDER BY [ActivityDate]
DESC"
UpdateCommand="UPDATE [RepairOrderNotes] SET [ActivityDate] =
@ActivityDate, [ActivityType] = @ActivityType, [ActivityNotes] =
@ActivityNotes, [EnteredBy] = @EnteredBy, [FollowupDate] = @FollowupDate
WHERE [NotesID] = @NotesID">
<SelectParameters>
<asp:ControlParameter ControlID="txtRecordID"
Name="txtRecordID" PropertyName="Text" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp
</DeleteParameters>
<InsertParameters>
<asp:ControlParameter ControlID="txtRecordID"
Name="txtRecordID" PropertyName="Text" Type="Int32" />
<asp
<asp
<asp
<asp
<asp
</InsertParameters>
<UpdateParameters>
<asp
<asp
<asp
<asp
<asp
<asp
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>