Review
Products.aspx
This page is for writing the users view for the product. When the user clicks on send button. details are recorded in a different table and are displayed in the productdetails page along with the users name .
The source code for this page when the user clicks
on send button is given below
private void
cmbSend_Click(object sender, System.EventArgs
e)
{
// Event fires when one clicks on send button.
int prid = (int)ViewState["proid"];//Capture the product id and store it in viewstate
SqlConnection
objcon = new
SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
objcon.Open();
SqlCommand
com = new
SqlCommand("addReviews",objcon); //
initialize the stored procedure of addreviews
com.CommandType
= CommandType.StoredProcedure;
SqlCommandBuilder.DeriveParameters(com);
com.Parameters["@ReviewID"].Value
= 0;
com.Parameters["@productid"].Value
= prid;
com.Parameters["@CustomerName"].Value
= txtCustomerName.Text; // Assign all the control values
to the stored procedure parameters.
com.Parameters["@CustomerEmail"].Value
= txtEmail.Text;
com.Parameters["@Rating"].Value
= cmbRating.SelectedItem.Text;
com.Parameters["@Comments"].Value
= txtComments.Text;
try
{
int i= com.ExecuteNonQuery();
if(i!=0)
{
string strprodid
=com.Parameters["@ReviewID"].Value.ToString();
String
strUrl ="ReviewPage.aspx?Mode=Edit" +"&"
+"productID="+prid+"&"+"ParentCode=";
strUrl
+= strprodid;
Response.Redirect(strUrl);
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}