PDA

View Full Version : using a button in DataList Problem


amative
11-11-2006, 04:09 PM
private void DataList1_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
int x = e.Item.ItemIndex;
int item_id=int.parse(Convert.ToString (DataList1.DataKeys[x]));
Session["id"]=item_id;
if(e.CommandName == "VIEW")
Response.Redirect("Item_Details.aspx" );
if(e.CommandName =="picture")
{
Button btn=(Button) e.Item.FindControl("button1");
btn.Attributes.Add (" onclick ","window.open('Item_Image.aspx','help','height=202,width=200')")
;
*********************************
hiiii
using (MS Visual Studio 2003)(C#)
****
i have a DataList that is used to display some items in a store ... for each item i display some info about it and a picture that is stored in the DataBase(SQL SERVER 2000) and there is a button to each item that is used to display the picture of that item what happens in the previous code that i have to click the button TWO TIMES in order to display the item image in the window
i hope to find a solution for the problem either using the way am using over or if there is another way
***************