I currently have a table in DetailsView that has insert / edit capabilities, and is also filtered based on customer (constituent) ID. Currently, the table only appears in a browser if the constituent has a previous entry to filter by. I need this table to be viewable for all constituents, even if they do not have a previous entry so we can insert new entries for that constituent. Please find my code below.
Any ideas? Thank you in advance.
Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="697px"
AllowPaging="True" AutoGenerateRows="False" DataKeyNames="NamedSeatId"
DataSourceID="SqlDataSource1">
<Fields>
<asp:BoundField DataField="ConstituentId" HeaderText="ConstituentId"
SortExpression="ConstituentId" />
<asp:BoundField DataField="NamedSeatId" HeaderText="NamedSeatId"
InsertVisible="False" ReadOnly="True" SortExpression="NamedSeatId" />
<asp:BoundField DataField="HallId" HeaderText="HallId"
SortExpression="HallId" />
<asp:BoundField DataField="SectionId" HeaderText="SectionId"
SortExpression="SectionId" />
<asp:BoundField DataField="Seat" HeaderText="Seat" SortExpression="Seat" />
<asp:BoundField DataField="GiftOf" HeaderText="GiftOf"
SortExpression="GiftOf" />
<asp:BoundField DataField="Honoree" HeaderText="Honoree"
SortExpression="Honoree" />
<asp:CommandField ButtonType="Button" ShowEditButton="True"
ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ImpresarioConnectionString-LIVE %>"
DeleteCommand="DELETE FROM [sl_NamedSeat] WHERE [NamedSeatId] = @original_NamedSeatId AND [HallId] = @original_HallId AND [SectionId] = @original_SectionId AND [Seat] = @original_Seat AND (([GiftOf] = @original_GiftOf) OR ([GiftOf] IS NULL AND @original_GiftOf IS NULL)) AND (([Honoree] = @original_Honoree) OR ([Honoree] IS NULL AND @original_Honoree IS NULL)) AND (([ConstituentId] = @original_ConstituentId) OR ([ConstituentId] IS NULL AND @original_ConstituentId IS NULL))"
InsertCommand="INSERT INTO [sl_NamedSeat] ([HallId], [SectionId], [Seat], [GiftOf], [Honoree], [ConstituentId]) VALUES (@HallId, @SectionId, @Seat, @GiftOf, @Honoree, @ConstituentId)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [sl_NamedSeat] Where ConstituentId = @ConstituentId"
UpdateCommand="UPDATE [sl_NamedSeat] SET [HallId] = @HallId, [SectionId] = @SectionId, [Seat] = @Seat, [GiftOf] = @GiftOf, [Honoree] = @Honoree, [ConstituentId] = @ConstituentId WHERE [NamedSeatId] = @original_NamedSeatId AND [HallId] = @original_HallId AND [SectionId] = @original_SectionId AND [Seat] = @original_Seat AND (([GiftOf] = @original_GiftOf) OR ([GiftOf] IS NULL AND @original_GiftOf IS NULL)) AND (([Honoree] = @original_Honoree) OR ([Honoree] IS NULL AND @original_Honoree IS NULL)) AND (([ConstituentId] = @original_ConstituentId) OR ([ConstituentId] IS NULL AND @original_ConstituentId IS NULL))">
<SelectParameters>
<asp:QueryStringParameter Name="ConstituentId" QueryStringField="ConstituentId" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="original_NamedSeatId" Type="Int32" />
<asp:Parameter Name="original_HallId" Type="Int32" />
<asp:Parameter Name="original_SectionId" Type="Int32" />
<asp:Parameter Name="original_Seat" Type="String" />
<asp:Parameter Name="original_GiftOf" Type="String" />
<asp:Parameter Name="original_Honoree" Type="String" />
<asp:Parameter Name="original_ConstituentId" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="HallId" Type="Int32" />
<asp:Parameter Name="SectionId" Type="Int32" />
<asp:Parameter Name="Seat" Type="String" />
<asp:Parameter Name="GiftOf" Type="String" />
<asp:Parameter Name="Honoree" Type="String" />
<asp:Parameter Name="ConstituentId" Type="Int32" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="HallId" Type="Int32" />
<asp:Parameter Name="SectionId" Type="Int32" />
<asp:Parameter Name="Seat" Type="String" />
<asp:Parameter Name="GiftOf" Type="String" />
<asp:Parameter Name="Honoree" Type="String" />
<asp:Parameter Name="ConstituentId" Type="Int32" />
<asp:Parameter Name="original_NamedSeatId" Type="Int32" />
<asp:Parameter Name="original_HallId" Type="Int32" />
<asp:Parameter Name="original_SectionId" Type="Int32" />
<asp:Parameter Name="original_Seat" Type="String" />
<asp:Parameter Name="original_GiftOf" Type="String" />
<asp:Parameter Name="original_Honoree" Type="String" />
<asp:Parameter Name="original_ConstituentId" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
Any ideas? Thank you in advance.