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

Update

3 Answers 21 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
khansa
Top achievements
Rank 1
khansa asked on 01 May 2011, 06:33 PM
Hi.

I save 3 images in the folder and images name in the database. Like this i added 3 records. Here is my code

  foreach (UploadedFile f in RadUpload1.UploadedFiles)
            {
                string strfolder;
                dataquery dq = new dataquery();
                string strsql;
                strfolder = Server.MapPath("../noon");
                f.SaveAs(strfolder + "\\" + f.GetName(), true);
                strsql = "insert into images(imid,imagname) values('1','" + f.GetName() + "')";
                dq.ExecuteQuery(strsql);
            }
Now i want to update my record and images. but i do't know how to show images in the Radupload control or then i what to write code for update.

Please can you see my above code and help me to write update code and select record images in the Radupload. I am not using Radgrid.

Thank you so much for help.

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Peter Filipov
Telerik team
answered on 03 May 2011, 05:44 PM
Hi khansa,

I have just answered to the same question in another thread. Here is my answer.

The RadUpload control can upload and validate files. My suggestion is to select all of the names from the DB (e.g. SELECT imageID, imangeName FROM images) and display them to the user.
After clicking on the image, the RadUpload control should appear. After a postback the file is saved into the folder. The name into the DB is updated(e.g. UPDATE images SET imageName= "newImageName" WHERE imageID = "ID").

Please consult with the following demo.

Kind regards,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Adel
Top achievements
Rank 1
answered on 03 May 2011, 07:54 PM
Dear Team.

In the refered demo Upload control uploading only one Image but in my question there is ( Multiple  Uploaded Files -- InputStream) Loop and then insert statement. Loop is uploading many images.... So refered demo I already impliment so where in my project. Here is my first code.
foreach (UploadedFile f in RadUpload1.UploadedFiles).....
strsql = "insert into images(imid,imagname) values('1','" + f.GetName() + "')";
...

I can insert many images and it working correct by I am unable to delete and Update there images.

I think i should do like this
                foreach (UploadedFile f in RadUpload1.UploadedFiles)
                dataquery dq = new dataquery();
                string strsql;
                strfolder = Server.MapPath("../noon");
                f.SaveAs(strfolder + "\\" + f.GetName(), true);

                strsql = "Update images imagname='" + f.GetName() + " where id=1 ";

                                 )
I Know above code is wrong because it is again uploading old images to server Folder "noon"
Also i dont know how to select insert record and show in the upload control.

In Other hand Here is link http://www.telerik.com/help/aspnet-ajax/upload_raduploadmanipulatingfiles.html
Please can you assist me how to write delete and Update querry.
I will be thankfull to you.
Thanks.
0
Peter Filipov
Telerik team
answered on 04 May 2011, 01:43 PM
Hi Adel,

We noticed that there is another support ticket regarding the same issue. To keep communication consistent and avoid duplication we will close this ticket.

Regards,
Peter Filipov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Upload (Obsolete)
Asked by
khansa
Top achievements
Rank 1
Answers by
Peter Filipov
Telerik team
Adel
Top achievements
Rank 1
Share this question
or