Sk Sahil

Sk Sahil

  • NA
  • 7
  • 696

display image along text in a panel

Nov 15 2017 1:31 AM
I'm making a real state base project, there I want to show images along with description in a panel, I wrote a code where the text overlapping. can anyone fix it??
 
string mycon = ConfigurationManager.ConnectionStrings["mycon"].ConnectionString;
SqlConnection scon = new SqlConnection(mycon);
string a = DropDownList1.SelectedItem.Text;
string loc = DropDownList2.SelectedItem.Text;
string price = DropDownList3.SelectedItem.Text;

SqlCommand cmd = new SqlCommand("select * from flats where location='"+loc+"' and price='"+price+"'",scon);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adp.Fill(ds, "fl");
Image[] i = new Image[ds.Tables["fl"].Rows.Count];
Label[] k = new Label[ds.Tables["fl"].Rows.Count];
for (int j = 0; j< ds.Tables["fl"].Rows.Count; j++)
{

i[j] = new Image();
i[j].Width = Unit.Pixel(640);
i[j].Height = Unit.Pixel(480);
i[j].Attributes.Add("style", "display:block;padding:5px;");
i[j].ImageUrl = ds.Tables["fl"].Rows[j][1].ToString();
k[j] = new Label();
k[j].Text = ds.Tables["fl"].Rows[j][4].ToString();
k[j].Attributes.Add("style", "float:left;margin-left:700px;position:absolute;top:350px;left:40px;padding:5px");
Panel1.Controls.Add(i[j]);
Panel1.Controls.Add(k[j]);
 

Answers (2)