如何将控制从javascript传递到asp.net中的codebehind

问题描述:




以下是我的代码。我正在接受一个文件上载控件,即

Hi
below is my code. I am taking one fileupload control i.e.,

<asp:FileUpload ID="FileUpload1" runat="server" onchange="Showpath(this)" />



和我的javascript代码是:


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希望在此方法中传递fileupload1控件PageMethods.SaveImage..

我该怎么办?



谢谢

K.Ajay


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

Thanks
K.Ajay

放弃。不可能。如果你能告诉我们你想要达到的目标,你可能会以其他可能的方式完成任务。
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.


你是否试图在没有提交按钮的情况下上传asp.net中的文件?然后使用此 http:// www .dotnetfunda.com / articles / article1062-fileupload-uploaded-file-to-the-server-without-click-a-button.aspx [ ^ ]
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[^]