Using LinQ ,I have a browse page where customer can select rows from a grid , the selected rows should be displayed in a shopping cart grid. Since, I was unable to do a grid to grid transfer I created a database table CART where I added each selected row to it using textboxes. Now, I call in values from CART table and display in shopping cart grid. How can I create sessions for all attributes(columns) of all items in the cart? I am not sure how to use array list for sessions and then extracting each session separately…
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CartID" DataSourceID="SqlDataSource1"
onselectedindexchanged="GridView1_SelectedIndexChanged" Height="189px"
Width="271px" SelectedIndex="1" ondatabound="GridView1_DataBound">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ItemID" HeaderText="ItemID"
SortExpression="ItemID" ReadOnly="True"/>
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name"
ReadOnly="True"/>
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price"
ReadOnly="True"/>
<asp:BoundField DataField="Quantity" HeaderText="Quantity"
SortExpression="Quantity" />
<asp:BoundField DataField="CartID" HeaderText="CartID" InsertVisible="False"
ReadOnly="True" SortExpression="CartID" Visible="False" />
</Columns>
</asp:GridView>
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
<!--UpdateCommand="UPDATE [Cart] SET [ItemID] = @ItemID, [Name] = @Name, [Price] = @Price, [Quantity] = @Quantity WHERE [CartID] = @original_C artID AND [ItemID] = @original_ItemID AND [Name] = @original_Name AND [Price] = @original_Price AND [Quantity] = @original_Quantity"-->
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:BookStoreConnectionString %>"
DeleteCommand="DELETE FROM [Cart] WHERE [CartID] = @original_CartID AND [ItemID] = @original_ItemID AND [Name] = @original_Name AND [Price] = @original_Price AND [Quantity] = @original_Quantity"
InsertCommand="INSERT INTO [Cart] ([ItemID], [Name], [Price], [Quantity]) VALUES (@ItemID, @Name, @Price, @Quantity)"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT ItemID, Name, Price, Quantity, CartID FROM Cart WHERE Quantity>0 AND CustID= @abc">