I have a function in the c# code that looks like:
protected void UploadFile(Object s, EventArgs e)
{
blah blah blah
}
and this function will upload file to the server.
i call to the function like this:
<asp:Button ID="uploadButton" runat="server" Text="Upload!" OnClick="UploadFile"/>
i want to pass another argument to the function, and its will be the name of the file.
but i tried to add it in the UploadFile and its not work, how can i do it? thanks.
That is an event attached to your
Button. You shouldn’t call the event like a method, instead you can extract the method logic to a separate method and then call that method with your parameter. As far as accessing theFileNameis concerned, you can access that from your File TextBox (probably you are using one)and to call it from somewhere else.