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

Casting File Name After Select The File From RadUpload

10 Answers 183 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Kenneth
Top achievements
Rank 1
Kenneth asked on 30 Apr 2009, 07:22 AM
Dear Telerik Team

    i have a function that is previously written by others that requires me to pass in the parameter as system.ui.html.controls.html.inputfile

Public Shared Function fileUpload(ByVal file As System.Web.UI.HtmlControls.HtmlInputFile, ByVal documentType As Enums.DocumentType) 

   is there anyway that i can write it to cast the selected file as HTMLINPUTFILE . ?? so that i can pass it in....

    my code is as follows
   
            For Each File As UploadedFile In RadUpload1.UploadedFiles 
 
                Dim filename As String = File.GetName 
 
                '//Cast file name 
 
            Next 
  

Kenneth Ng

10 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 30 Apr 2009, 08:11 AM
Hello Kenneth,

What does your function do ? You cannot cast UploadedFile class to a HTMLInputFile because there is nothing common between them, the first is Telerik created class to hold an uploaded file and the second is HTML File Input control.

Best wishes,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kenneth
Top achievements
Rank 1
answered on 30 Apr 2009, 08:47 AM
the function will load the file read the file and insert it to our database

do you know any other work around this ?
0
Genady Sergeev
Telerik team
answered on 30 Apr 2009, 10:22 AM
Hello Kenneth,

You can iterate through the uploaded files collection and call your Insert method for all the files. You need to change  the ByVal file As System.Web.UI.HtmlControls.HtmlInputFile parameter to
ByVal file As Telerik.Web.UI.UploadedFile.  However, you will need to change your Insert method logic accordingly.

Done that, the correct way to call your method is:

For Each File As UploadedFile In RadUpload1.UploadedFiles 
fileUpload(File, 'the other parameter)  
Next 


Sincerely yours,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kenneth
Top achievements
Rank 1
answered on 30 Apr 2009, 10:28 AM
will give this a shot and see what i can get

btw.. happy labour day ...
0
Kenneth
Top achievements
Rank 1
answered on 04 May 2009, 09:46 AM
i have a problem i prompted me that that the rad file upload can only be work in a form tag

what should i do?

0
Genady Sergeev
Telerik team
answered on 04 May 2009, 11:23 AM
Hello Kenneth,

All controls that work with a postback ( for example - RadUpload ) need to be placed inside a form tag
 <form id="form1" runat="server"> ... content ... </form>
Please make sure that your aspx page contains exactly 1 form tag and your upload is placed there.

Regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kenneth
Top achievements
Rank 1
answered on 05 May 2009, 03:08 AM
oh yeah sorry i forgotten to mention

that the control i called in place in side a user control which is called from a aspx page which contains a master page

the master page already has a form tag in it..
0
Genady Sergeev
Telerik team
answered on 05 May 2009, 03:18 PM
Hi Kenneth,

ASPX pages cannot contain master pages, it is exactly the opposite. The chain should be: Master page -> ASPX content page -> User Control -> Control. This approach should not cause any problems. Is there something special concerning your project? Please make sure that the ContentPlaceHolders of your master page are inside a form tag. For your convenience I have prepared sample demo project describing the approach.

Kind regards,
Genady Sergeev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kenneth
Top achievements
Rank 1
answered on 06 May 2009, 03:30 AM
Dear Genady Sergeev

   my control is called like this

   master page --> aspx page --> rad tab strip --> .ascx --> ragrid (which containts the radupload inside)

  i tried to place the radupload control into the ascx page and do a count of it i returns 0

  do enlighten me

Kenneth Ng
  
0
Atanas Korchev
Telerik team
answered on 06 May 2009, 06:38 AM
Hi Kenneth,

Unfortunately the provided information is not sufficient. I suggest you open a support ticket and send us a running sample of your setup. Thanks.

Regards,
Albert
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Upload (Obsolete)
Asked by
Kenneth
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Kenneth
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or