?
Solved

insert datagrid row to temp table

Posted on 2008-10-13
5
Medium Priority
?
324 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

840 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