Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2007, 09:22 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Gridview

Hi All

I would like to know how I can do the following

1. How to select Product Code from Child form gridview
2. Use the selected product details from child form (as per point 1) and update the parent from gridview


Kind regards


Mark
 
Old July 19th, 2007, 10:39 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

either explain a bit more or provide code which u are using

thanks......
 
Old July 20th, 2007, 08:33 AM
Registered User
 
Join Date: May 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Gridview user007 ASP.NET 2.0 Basics 2 June 22nd, 2008 09:30 AM
GridView Sheraz Khan ASP.NET 2.0 Basics 1 July 19th, 2007 10:28 AM
GridView heba ASP.NET 2.0 Professional 0 May 28th, 2007 01:59 AM
GridView simonwilbert ASP.NET 2.0 Basics 4 August 12th, 2006 02:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.