This is a migrated thread and some comments may be shown as answers.

how to insert an image to the telerik grid column

0 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
vinkesh
Top achievements
Rank 1
vinkesh asked on 12 Jul 2011, 07:46 AM
hello telerik
i am trying to insert the image to the telerik grid but i am unable to insert the image ican only able to show the image number not the image will you help me out on this
my code  for inerting the image will be


on controoler:
public ActionResult _TemplatesClientSide(int Id)
         {
             var tst = new test
            {
                Id = Id,

            };
             if (TryUpdateModel(tst))
             {
                 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
                 if (con.State == ConnectionState.Closed)
                 {
                     con.Open();
                 }
                 SqlCommand cmd1 = new SqlCommand();
                 cmd1.CommandText = "Select country_img from tb_Country where country_Id=@country_Id";
                 cmd1.Connection = con;
                 cmd1.Parameters.AddWithValue("@country_Id", tst.country_Id);
                 cmd1.Parameters.AddWithValue("@country_img", tst.country_img);
                 cmd1.ExecuteNonQuery();
                 con.Close();
             }
             var tme = new db_TestEntities1();
             ViewData["tb_TestMvc"] = tme.tb_Country.ToList();
             return RedirectToAction("Index", "Home");
             }
         }
   }
for index:
   columns.Bound(p => p.Id)       
                   .ClientTemplate("<img width='100' height='110' alt='<#=Id #>' src='"
                    + Url.Content("../../Images/")
                     + "<#=Id #>.jpg' />")
                     .Title("Picture");
Tags
Grid
Asked by
vinkesh
Top achievements
Rank 1
Share this question
or