con.Open(); da = new SqlDataAdapter(str, con); da.Fill(ds); PlaceHolder1.Controls.Clear(); Table tbl = new Table(); PlaceHolder1.Controls.Add(tbl); for ( i = 0; i < 5; i++) { TableRow tr = new TableRow(); for (int j = 0; j < 2; j++) { TableCell tc = new TableCell(); HyperLink h1 = new HyperLink(); Image img = new Image(); ImageButton imgbt = new ImageButton(); if (j == 0) { imgbt.ImageUrl = ds.Tables[0].Rows[i]["picture"].ToString(); imgbt.Height = 50; imgbt.Width = 50; imgbt.Click += new ImageClickEventHandler(imgbt_Click); ds.Tables[0].Rows[i]["picture"].ToString(); tc.Controls.Add(imgbt); } else { h1.Text = ds.Tables[0].Rows[i]["Name"].ToString(); // Add the control to the TableCell tc.Controls.Add(h1); } h1.ForeColor = System.Drawing.Color.Black; h1.NavigateUrl = ds.Tables[0].Rows[i]["PageUrl"].ToString(); // Add the TableCell to the TableRow tr.Cells.Add(tc); } // Add the TableRow to the Table tbl.Rows.Add(tr); } } catch { } } void imgbt_Click(object sender, ImageClickEventArgs e) { //throw new NotImplementedException(); Response.Write("welcome"); string str1 = ""; string str2 = "'" + ds.Tables[0].Rows[i]["Name"] + "'"; string str3 = "'" + ds.Tables[0].Rows[i]["Adress"] + "'"; str1 = "'" + ds.Tables[0].Rows[i]["picture"] + "'"; Page.ClientScript.RegisterStartupScript(this.GetType (), "Test", "getpoint(" + ds.Tables[0].Rows[i]["Latitude"] + "," + ds.Tables[0].Rows[i]["Longitude"] + "," + str1 + "," + str2 + "," + str3 + ");", true); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)