Product Details.aspx

 

This page displays the details of the product select in the display page.Here I have provided three functionalities….viz ADD to Cart, Rate Product, Recommend To Friend.

 

The last one ie Recommend links to a  email generation page which takes the recepient to the particlar product details.

 

Rate product –Links you to product rating page in which you can rate the product as well as can give your comments on the product which would be displayed in the comments section of the page.

 

The most important part of the page is a DataList  which displays the details of the product.

 

I have used a user control named ProductReviews.ascx  in the item Template  of the dataList to give the product reviews

 

The source code for the page revolves around the datalist.

 

 

private void Page_Load(object sender, System.EventArgs e)

              {

                    

                     // Take the specific product id from the parameter sent from default page

                    

int urlproductid = Int32.Parse(Request.Params["productID"]);

 

// By using the Request.Querystring and Request.Params we can capture the product id from the posted page.

                    

SqlConnection objCon = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);

 

string sql = "Select pr.productid,pr.categoryid,pr.internalproductsubcategoryid,ps.categorysubname,pr.modelnumber,pr.modelname,pr.unitcost,pr.description,im.imagename from images im,productsubcategory ps,products pr where pr.internalproductsubcategoryid = ps.internalproductsubcategoryid and im.productid = pr.productid and pr.productid ='" + urlproductid +"'";

      

SqlDataAdapter objda = new SqlDataAdapter(sql,objCon); // Sqldataadapter is used to fill the dataset.

                    

DataTable ds = new DataTable();    // SQL query to display the image and the other product details given the productid

                    

 

objda.Fill(ds);

                     foreach(DataRow dr in ds.Rows)

                     {

                           strparent =dr["productid"].ToString();// Ignore this this was to check

                     }

               

                     dsProductlist.DataSource = ds;// Bind the Datalist to the dataset.

                     dsProductlist.DataBind();

 

                    

 

             

              }

 

 

 

Back to the Main Page