Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 16th, 2007, 09:22 AM
Registered User
 
Join Date: May 2007
Location: Cape Town, , South Africa.
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
Reply With Quote
  #2 (permalink)  
Old July 19th, 2007, 10:39 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

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

thanks......
Reply With Quote
  #3 (permalink)  
Old July 20th, 2007, 08:33 AM
Registered User
 
Join Date: May 2007
Location: Cape Town, , South Africa.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:05 PM.


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