Hi
What I have is as follows
A form called invoice.aspx on that form I have a button to search all products on a Sage database. The button opend another form called product search. At the moment that form gets populated with the data no problem (using gridview) my problem is that I can not select a product from the product search from and update the invoice form with that product data (e.g code, price, etc)
I know that the gridview can have a checkbox in it to select the product but I do not know how to code this in the form as when i search the forums nobody specifies what code goes where
the product from code as below
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Odbc;
public partial class Products : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OdbcConnection Con = new OdbcConnection("Dsn=SageLine50v12;uid=manager;pwd= tijane");
Con.Open();
OdbcCommand Command = new OdbcCommand("Select Stock_Code,Description,Sales_Price from Stock", Con);
OdbcDataAdapter DataAdapter = new OdbcDataAdapter(Command);
DataSet DS = new DataSet();
DataAdapter.Fill(DS);
GVProducts.DataSource = DS;
Con.Close();
Page.DataBind();
}
}
aspx file
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Products.aspx.cs" Inherits="Products" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GVProducts" runat="server" BorderColor="Black" BorderStyle="Solid" BorderWidth="2px" Caption="Product Details" CaptionAlign="Top">
<RowStyle BackColor="#C0FFFF" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
<SelectedRowStyle BackColor="#C0FFFF" BorderColor="#404040" BorderStyle="Solid" BorderWidth="1px" />
<HeaderStyle BackColor="DeepSkyBlue" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Regards
Mark
aspx.cs file
|