Click here to Skip to main content
13,550,805 members
Rate this:
Please Sign up or sign in to vote.
See more:
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?

Posted 7-Jan-13 3:18am
Updated 7-Jan-13 3:24am
aspnet_regiis -i 7-Jan-13 9:23am
Totally wrong approach.... You need to learn The basic thing is that a control cannot be passed in webmethods, only the values can be..
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.
Rate this: bad
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.
Good idea, a 5. Really helps. No joking, helps to stop wasting time.
Zafar Sultan 8-Jan-13 2:47am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Are you trying to upload a file in without submit button ? Then use this[^]
Right idea, not sure it will help OP. A 5 anyway.
aspnet_regiis -i 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..
aspnet_regiis -i 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04-2016 | 2.8.180515.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2018
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