Image in Grid View

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PrakashN
    New Member
    • Sep 2007
    • 43

    Image in Grid View

    Hi,
    i am using the gridview to display the image, but the path only getting visisble..
    Like this "/ShoppingGridVie w/images/1.jpg"
    What is the wrong here.. please help me..


    con.Open();
    string queryString = "Select * from Item";
    OdbcCommand com = new OdbcCommand(que ryString, con);
    OdbcDataReader DR1 = com.ExecuteRead er();
    DataTable dt = new DataTable();
    dt.Columns.Add( new DataColumn("Pic tureID", typeof(int)));
    dt.Columns.Add( new DataColumn("Pic ture", typeof(string)) );
    dt.Columns.Add( new DataColumn("Nam e", typeof(string)) );
    while (DR1.Read())
    {
    DataRow dr = dt.NewRow();
    dr["PictureID"] = DR1[0];
    dr["Picture"] = ResolveUrl("~/images/"+DR1[0]+".jpg");
    dr["Name"] = DR1[1];
    dt.Rows.Add(dr) ;
    }
    GridView1.DataS ource = dt;
    GridView1.DataB ind();
    con.Close();
Working...