Click here to Skip to main content
Sign Up to vote bad
good
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:18
Edited 7 Jan '13 - 3:24

Comments
aspnet_regiis -i - 7 Jan '13 - 9:23
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:48
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

2 solutions

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 - 7 Jan '13 - 18:48
Good idea, a 5. Really helps. No joking, helps to stop wasting time. —SA
Zafar Sultan - 8 Jan '13 - 2:47
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[^]
  Permalink  
Comments
Sergey Alexandrovich Kryukov - 7 Jan '13 - 18:49
Right idea, not sure it will help OP. A 5 anyway. —SA
aspnet_regiis -i - 7 Jan '13 - 23:47
Thanks SA :)
ajay.raju531 - 8 Jan '13 - 1:21
Thanks, Yes i am trying to upload image with out submit..
aspnet_regiis -i - 8 Jan '13 - 2:01
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 435
1 OriginalGriff 330
2 Arun Vasu 293
3 CPallini 213
4 Zoltán Zörgő 194
0 Sergey Alexandrovich Kryukov 10,105
1 OriginalGriff 7,739
2 CPallini 4,181
3 Rohan Leuva 3,482
4 Maciej Los 2,999


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