Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello

I have a gridview, grid view contains image column, now after i click edit button in gridview i want the image path to get generated on another page, rest all columns are generated properly.

Please help.

My code for generating columns to another page is:
C#
private int ID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        ID = Convert.ToInt32(Request.QueryString["ID"].ToString());
        if (!IsPostBack)
        {
            BindControlvalues();
        }
    }

    private void BindControlvalues()
    {
        con.Open();
        SqlCommand cmd = new SqlCommand("SELECT * FROM tbl_SqlImage where ID=" + ID, con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        con.Close();
        DataSet ds = new DataSet();
        da.Fill(ds);
        txtName.Text = ds.Tables[0].Rows[0][1].ToString();
        txtDesc.Text = ds.Tables[0].Rows[0][2].ToString();
        //lblImage.Text = ds.Tables[0].Rows[0][3].ToString();
        DropDownList1.Text = ds.Tables[0].Rows[0][4].ToString();
        txtCreatedBy.Text = ds.Tables[0].Rows[0][5].ToString();
        txtCreDate.Text = ds.Tables[0].Rows[0][6].ToString();
    }
Posted
Updated 26-Jun-12 19:53pm
v2
Comments
Vani Kulkarni 27-Jun-12 1:54am    
What is the datatype you are using for Image in the database and what is the error you are facing?

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