Click here to Skip to main content
16,021,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello to all,
I am making an ASP.NET web application.
I am using the rad grid of telerik. In that grid I am also saving the path of image as i make a directory in which the images are saving and also images are saving in database.

Now i want that image should be visible in the grid but its not happening. On insert i am doing this.

C#
protected void radgrid_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
    {
        GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
        string txtmodalname = (insertedItem.FindControl("txtmodalname") as RadTextBox).Text;
        string txtqty = (insertedItem.FindControl("txtqty") as RadTextBox).Text;
        string txtprice = (insertedItem.FindControl("txtprice") as RadTextBox).Text;
        string category = (insertedItem.FindControl("cmbcategory") as RadComboBox).Text;
        string subcategory = (insertedItem.FindControl("subcategory") as RadComboBox).Text;
        RadUpload upload = (insertedItem.FindControl("RadUpload1") as RadUpload);
        string file = upload.UploadedFiles[0].FileName;
        int maxid = 0;
        SqlCommand cmd1 = con.CreateCommand();
        cmd1.CommandText = "select isnull(max(id),0) from itemadd";
        SqlDataReader dr1;
        dr1 = cmd1.ExecuteReader();

        while (dr1.Read())
        {
            maxid = int.Parse(dr1.GetInt32(0).ToString());
        }
        maxid = maxid + 1;


        if (upload.UploadedFiles.Count > 0)
        {
            string filename = upload.UploadedFiles[0].FileName;
        }

        string value = maxid + "," + txtmodalname + "," + category + "," + subcategory + "," + txtqty + "," + txtprice + "," +file ;
        ExecuteSP("id,modelname,category,subcategory,quantity,price,fileupload", value, "insertitem");

}

Please tell what will i have to do in design as well as in coding? whether i will have to save in this way to retrieve or any other way is there?
Posted
Updated 26-Jul-10 20:06pm
v2

1 solution

If the images are in the database, you need a HTTP handler or just a page that takes a database id to return the bytes of the image.,
 
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