Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi
 
below is my code. I am taking one fileupload control i.e.,
<asp:FileUpload ID="FileUpload1" runat="server" onchange="Showpath(this)" />
and my javascript code is:
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.,
<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 7-Jan-13 3:18am
Edited 7-Jan-13 3:24am
v2
Comments
aspnet_regiis -i at 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 at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 7-Jan-13 18:48pm
   
Good idea, a 5. Really helps. No joking, helps to stop wasting time.
—SA
Zafar Sultan at 8-Jan-13 2:47am
   
Thanks.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 7-Jan-13 18:49pm
   
Right idea, not sure it will help OP. A 5 anyway.
—SA
aspnet_regiis -i at 7-Jan-13 23:47pm
   
Thanks SA :)
ajay.raju531 at 8-Jan-13 1:21am
   
Thanks, Yes i am trying to upload image with out submit..
aspnet_regiis -i at 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 580
1 ashok rathod 159
2 CPallini 140
3 CHill60 130
4 BillWoodruff 125
0 Sergey Alexandrovich Kryukov 9,543
1 OriginalGriff 6,984
2 CPallini 5,820
3 George Jonsson 4,017
4 Gihan Liyanage 3,266


Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100