Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
below is my code. I am taking one fileupload control i.e.,
XML
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Showpath(this)" />

and my javascript code is:
JavaScript
function Showpath(e) {
         var file;
         file = e;
         PageMethods.SaveImage("how to pass fileupload control here");
         }

in my .vb page i write one function i.e.,
VB
<System.Web.Services.WebMethod()> _
    Public Shared Function SaveImage(ByVal fUpload As fileupload) As String

    Return ""

    End Function

i want to pass the fileupload1 control in this method "PageMethods.SaveImage"..
how can i do it?

Thanks
K.Ajay
Posted
Updated 7-Jan-13 3:24am
v2
Comments
bbirajdar 7-Jan-13 9:23am    
Totally wrong approach.... You need to learn asp.net. The basic thing is that a control cannot be passed in webmethods, only the values can be..
Sergey Alexandrovich Kryukov 7-Jan-13 18:48pm    
I would say, to learn what the Web does. I don't see a sense in answering just yet; more simple things should be understood first.
—SA

Give up. Not possible. If you can tell us what you want to achieve, you have better chances to get things done maybe in other possible ways.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Jan-13 18:48pm    
Good idea, a 5. Really helps. No joking, helps to stop wasting time.
—SA
Zafar Sultan 8-Jan-13 2:47am    
Thanks.
Are you trying to upload a file in asp.net without submit button ? Then use this http://www.dotnetfunda.com/articles/article1062-fileupload-uploading-file-to-the-server-without-clicking-a-button.aspx[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Jan-13 18:49pm    
Right idea, not sure it will help OP. A 5 anyway.
—SA
bbirajdar 7-Jan-13 23:47pm    
Thanks SA :)
ajay.raju531 8-Jan-13 1:21am    
Thanks, Yes i am trying to upload image with out submit..
bbirajdar 8-Jan-13 2:01am    
Great.. You should have mentioned that earlier....

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