TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Harsh Jani
NA
34
53.4k
Getting the value of Query String
Oct 6 2014 1:39 AM
Hi!
I have created a simple online shopping application, where if a user clicks on a product image he will be directed to the Product Details page. My question is how to get the Product Id of that particular Product that the user has clicked using query string. I have tried the following code.
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("Product_Details.aspx?Product_Id={0}");
}
In the Product details page, the code is as given below:-
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
FillDataList();
}
private void FillDataList()
{
cmd = new SqlCommand("select Product_Category_Name, Product_Id, Product_Name, Product_Image, Price from Product_Category_Mst a, Product_Mst b where a.Product_Category_Id = b.Product_Category_Id and Product_Id = @Product_Id", con);
int Product_Id = Convert.ToInt16(Request.QueryString["Product_Id"]);
cmd.Parameters.AddWithValue("@Product_Id", Product_Id);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
DataList1.DataSource = dt;
DataList1.DataBind();
}
Kindly help me out in this regard.
Reply
Answers (
3
)
-HELP- Adding up Total from Subtotal.
Google combo chart percentage line error shows down