Solved

insert datagrid row to temp table

Posted on 2008-10-13
5
314 Views
Last Modified: 2012-08-14
i have a grid (see below)  and want to add those items on click event to a temp table.  
it works kinda like a shopping cart.  is there a good way to do this in asp.net 2.0 ???
or should i create a table and store items??

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
                    BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px"
                    CellPadding="3" CellSpacing="1" DataSourceID="SqlDataSource1"
                    GridLines="None" EmptyDataText="No options available">
                    <RowStyle BackColor="White" ForeColor="Black" />
                    <Columns>
                        <asp:BoundField DataField="itemdescription" HeaderText="Item"
                            ReadOnly="True"  />
                        <asp:BoundField DataField="price" DataFormatString="{0:c}" HeaderText="Price"
                            HtmlEncode="False" ReadOnly="True" SortExpression="price" />
                            <asp:TemplateField><ItemTemplate>
                                <asp:Image ID="Image1" runat="server" ImageUrl="images/tabs/configurator/addItems.jpg" /></ItemTemplate></asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                    <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
                    <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#FE8330" Font-Bold="True" ForeColor="#E7E7FF" />
                </asp:GridView>
0
Comment
Question by:gianitoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Expert Comment

by:3abqari
ID: 22705963
You can opt to use a Datacache object and save that information in it and give it a name that is user specific
0
 
LVL 1

Author Comment

by:gianitoo
ID: 22706029
can you show me example???
need direction.  
the project i am working on is a configurator.  
once you get a product , you can add options (in this case the grid will have the options)  each option has a price and you will add/delete.  at the end you can generate quote based on all options and after that then i can add all the items into my database because they have been approved.  
0
 
LVL 3

Expert Comment

by:3abqari
ID: 22706072
Are you using C# or VB.NET?
0
 
LVL 1

Author Comment

by:gianitoo
ID: 22706084
vb.net
0
 
LVL 3

Accepted Solution

by:
3abqari earned 500 total points
ID: 22706281
You'll need a function BindData() that will contain the following code (keep in mind that this is pseudo code):

Define a new DataSet and name it let's say ds1 (Dim ds1 as new DataSet)
 
If (Cache["DataSet"] is NULL) Then
  gv.datasource = ds1
  gv.databind()
 ELSE
  gv.datasrouce = Cache["DataSet"]
  gv.databind()
 Endif
 
 Then, you need to create the Add, delete, and update functionalities to the gridview so that it would save it in the gridview
 And, somewhere on that same page, you would put a button that would say "Save" or "Commit" that would take the Cache["DataSet"] object and would save it back to the Database.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question