Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Question about JavaScript and ASP.NET

Thread Tools

Question about JavaScript and ASP.NET

Marko Vuksanovic
Posts: n/a

I am trying to notify a user of a fileUpload being in progress, in
page what I have done is:
1. created file upload control
2. created a button (id="upload") that runs a javascript that shows popup
and initiates button1 postback
3. button1 that should do the upload

the relevant code is below:
<asp:FileUpload id="FileUpload1" runat="server"> </asp:FileUpload>
<asp:Button id="Upload" Text="Upload file" runat="server"
OnClientClick="show_popup()"> </asp:Button>

<asp:Button id="Button1" OnClick="UploadButton_Click" runat="server"
Visible="false"> </asp:Button>

public partial class FileUpload : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
Upload.Attributes.Add("onClick", "__doPostback('" + Button1.ClientID +
"','');return false");
GetPostBackClientEvent(Button1, "");

protected void UploadButton_Click(object sender, EventArgs e)
String savePath = @"C:\Temp\uploads\";
if (this.FileUpload1.HasFile)
String fileName = FileUpload1.FileName;
savePath += fileName;

When I try to run the pag and do the upload Javascript throws the error
"Object expected", in the line where Button (id="Upload") is defined.... Any
ideas what I am doing wron?

Thanks, M.V.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about question mark in JavaScript Jimolo Javascript 2 01-20-2008 05:02 PM
Javascript and IE? Javascript and C#? porter Javascript 6 10-06-2007 10:03 AM
dynamic javascript and html using javascript parez Javascript 0 09-11-2007 04:08 PM
href="javascript:func()" vs href="#" onclick="javascript:func()" CRON HTML 24 06-20-2006 08:05 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM