hi friends
i have a datalist on my page and design it on template
i have some button and image and hyperlink to it;
now i wand when i clicked a button of one item's , i can get id of that item
how can i do that?
my code is here but with some error
protected void Button1_Click(object sender, EventArgs e) { Label1.Text = ProdID.ToString(); // ShoppungCart.GetShoppingCart().AddItem(ProdID); // Response.Redirect("ViewCart.aspx"); } protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { int ProdID = Convert.ToInt32(DataList1.DataKeys[e.Item.ItemIndex]); }
|
but label1 is null and maybe ProdID is null;
why?