Ok, I have had a few response on using the item template.  However, 
I have had to create almost everything in the datagrid at runtime.  
The Image is basically stored as a url location on the webserver.  
Will this item template work, and how do I use it with creating 
these things at run time.  Here is the code if that helps:

namespace Custom
{
        using System;
        using System.Data;
        using System.Data.OleDb;
        using System.Drawing;
        using System.Web;
        using System.Web.UI.WebControls;
        using System.Web.UI.HtmlControls;

        public class Products : System.Web.UI.UserControl
        {
                protected System.Web.UI.WebControls.DataGrid 
dgProducts;
                protected System.Data.OleDb.OleDbConnection 
oleDbConnection1;
                DataView dv;

                private void Page_Load(object sender, 
System.EventArgs e)
                {
                        oleDbConnection1.ConnectionString 
= "Provider=SQLOLEDB;Data 
Source=whsql03.prod.mesa1.secureserver.net,1433;Database=D" +
                                "B_9153;User 
Id=creator;Password=yosef";
                        OleDbCommand cmd = new OleDbCommand
("spProducts", oleDbConnection1);
                        cmd.CommandType = 
CommandType.StoredProcedure;
                        OleDbDataAdapter oda = new OleDbDataAdapter
();
                        oda.SelectCommand = cmd;
                        DataSet ds = new DataSet();
                        oda.Fill(ds, "tblItems");
                        dv = new DataView(ds.Tables["tblItems"]);
                        dgProducts.AllowPaging = true;
                        dgProducts.PagerStyle.Mode = 
PagerMode.NumericPages;
                        dgProducts.PagerStyle.PageButtonCount = 5;
                        dgProducts.PageSize = 5;
                        dgProducts.DataSource = dv;
                        dgProducts.AllowSorting = true;
                        
                        if (!Page.IsPostBack) 
                        {                               
                                dgProducts.DataBind();
                        }                       
                }

                #region Web Form Designer generated code
                override protected void OnInit(EventArgs e)
                {
                        InitializeComponent();
                        base.OnInit(e);
                }

                private void InitializeComponent()
                {
                        this.oleDbConnection1 = new 
System.Data.OleDb.OleDbConnection();
                        this.dgProducts.PageIndexChanged += new 
System.Web.UI.WebControls.DataGridPageChangedEventHandler
(this.dgProducts_PageIndexChanged);
                        this.dgProducts.SortCommand += new 
System.Web.UI.WebControls.DataGridSortCommandEventHandler
(this.dgProducts_SortCommand);
                        this.Load += new System.EventHandler
(this.Page_Load);

                }
                #endregion

                private void dgProducts_PageIndexChanged(object 
source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
                {
                        dgProducts.CurrentPageIndex = e.NewPageIndex;
                        dgProducts.DataBind();
                }

                private void dgProducts_SortCommand(object source, 
System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
                {
                        dv.Sort = e.SortExpression;
                        dgProducts.DataBind();
                }
        }
}





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to