Click here to Skip to main content
16,005,178 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void bind()
   {
   ListBox1.DataSource = lst;
       ListBox1.DataBind();
       ListBox1.DataValueField = (lst[0].propertyid).ToString();
       TextBox6.Text = lst[0].ToString();
       Image1.ImageUrl = "~/Landpics" + lst[3].Pimage.ToString();
       TextBox8.Text = (lst[2].sqrft).ToString();
       TextBox9.Text = lst[3].propertytype.ToString();
       TextBox10.Text = lst[4].location.ToString();
       TextBox7.Text = lst[1].priceland.ToString();


}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bind();
}
}
//and my 3 tier coding is as follows=====
public List<clslandprp> dspland(clslandprp r)
{
SqlCommand cmd = new SqlCommand("dspland", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@propertyid", SqlDbType.Int).Value = Convert.ToInt32(r.propertyid);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
SqlDataReader dr = cmd.ExecuteReader();
List<clslandprp> lst = new List<clslandprp>();
if (dr.HasRows)
{
dr.Read();
clslandprp k = new clslandprp();
k.priceland = Convert.ToInt32(dr[1]);
k.sqrft = Convert.ToInt32(dr[2]);
k.Pimage = dr[3].ToString();
k.propertytype = dr[4].ToString();
k.location = dr[5].ToString();
lst.Add(k);

}
cmd.Dispose();
con.Close();
return lst;

}
please provide me some idea how to do it..
it is not giving me .. the desired result..
i want all the things to be displayed in the user interface
Posted
Updated 2-Dec-10 4:00am
v4

1 solution

Well, first of all after you call
C#
ListBox2.DataSource = lst;


you forgot to call
C#
ListBox2.DataBind();


Fix this and let me know if the code works

Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900