how to set data from sql query into the gridview template field
<p>In my SQL query I retrieve 3 strings and the 3rd string has an URL. I created 2 templatefield contain labels and another template with an image. Now I want to set the values to the two labels and view the image by setting ImageUrl and display all the rows coming out from SQL query. </p>

<pre><code>protected void Page_Load(object sender, EventArgs e)
{
    //if (IsPostBack == false)
    //{
    //    grdMaterial.DataBind();
    //}
    try
    {
        matType = int.Parse(Session["mattype"].ToString());
        colorId = int.Parse(Session["color"].ToString());
        matStyleId = int.Parse(Session["matstyle"].ToString());
        try
        {
            matContent = Session["matContent"].ToString();
        }
        catch
        {
            panAval.Visible = true;
            panNew.Visible = false;
            dtab = new DBHELPER().getdataTable("SELECT [item_Id],[mat_Content],[mat_Image] FROM [item] WHERE [mat_Content]='" + matContent + "'");
            //grdMaterial.DataSource = dtab;
            //grdMaterial.DataBind();



    }
    catch (Exception ee)
    {
    }

}

protected void grdMaterial_Load(object sender, EventArgs e)
{
    try
    {
        for (int i = 0; i &lt; dtab.Rows.Count; i++)
        {
            //TextBox x = (TextBox)GridViewCarrinho.Rows[row.RowIndex].Cells[2].FindControl("txtQuantidade");


            Label itemId = (Label)grdMaterial.FindControl("lblItemId");
            itemId.Text = dtab.Rows[i]["item_Id"].ToString();

            Label matContent = (Label)grdMaterial.FindControl("lblItemName");
            matContent.Text = dtab.Rows[i]["mat_Content"].ToString();

            Image itemImage = (Image)grdMaterial.FindControl("imgItemImage");
            itemImage.ImageUrl = dtab.Rows[i]["mat_Image"].ToString();

        }
    }
    catch (Exception ee)
    {
    }
}
</code></pre>
