Solved

insert datagrid row to temp table

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

691 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