Solved

insert datagrid row to temp table

Posted on 2008-10-13
5
313 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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