error with updatepanel - asp.net

PROBLEM
When i put
<asp:FileUpload ID="FileUpload1" runat="server" class="multi" />
<br />
<asp:Button ID="btnUpload" runat="server" Text="Upload All" /> outside the update panel everything works fine,but as soon as i put it back into the update panel...it stops working.
ASPX CODE
<%# Page Language="VB" AutoEventWireup="false" CodeFile="try.aspx.vb" Inherits="AdminPanel_try" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="../js/multi-upload/jquery-1.3.2.js" type="text/javascript"></script>
<script src="../js/multi-upload/jquery.MultiFile.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" class="multi" />
<br />
<asp:Button ID="btnUpload" runat="server" Text="Upload All" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnUpload" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
CODE BEHIND
Partial Class AdminPanel_try
Inherits System.Web.UI.Page
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Try
' Get the HttpFileCollection
Dim hfc As HttpFileCollection = Request.Files
For i As Integer = 0 To hfc.Count - 1
Dim hpf As HttpPostedFile = hfc(i)
If hpf.ContentLength > 0 Then
hpf.SaveAs(Server.MapPath("MyFiles") & "\" & System.IO.Path.GetFileName(hpf.FileName))
Response.Write("<b>File: </b>" & hpf.FileName & " <b>Size:</b> " & hpf.ContentLength & " <b>Type:</b> " & hpf.ContentType & " Uploaded Successfully <br/>")
End If
Next i
Catch ex As Exception
End Try
End Sub
End Class
NOTE:
i am using this tutorial kindly check this link

The UpdatePanel does not support all ASP.NET controls, FileUpload being one of them (http://msdn.microsoft.com/en-us/library/bb386454.aspx).
There are several examples on the Internet, and even here on StackOverflow, that will show you how to support asynchronous file uploads in ASP.NET.

Related

Assigning FormView value to VB variable

I am trying to assign a FormView value to a VB variable.
I am using code that works fine when first_nameTextBox is a TextBox and user enters data directly, but fails when first_nameTextBox is a label populated from a database via FormView.
Error I receive is BC30451: 'FormView2_first_nameTextBox' is not declared. It may be inaccessible due to its protection level.
Any help much appreciated.
The code is below;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%# Page Language="VB" %>
<%# Import Namespace="System.Net.Mail" %>
<%# Import Namespace="System.Text" %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head runat="server">
<!-- Scripting area here -->
<script runat="server" type="text/vbscript">
Protected Sub btnSubmit_click (ByVal sender As Object, ByVal e As EventArgs)
If IsPostBack Then
Dim sc As SmtpClient = New SmtpClient("relay.hostinguk.net")
Dim sb As StringBuilder = New StringBuilder()
Dim msg As MailMessage = Nothing
sb.Append("Name : " + FormView2_first_nameTextBox.Text + vbCrLf)
Try
msg = New MailMessage("from#company.com", _
"to#company.com", "Contact details for Co", _
sb.ToString())
sc.Send(msg)
Catch ex As Exception
' something bad happened
Response.Write("Something bad happened! - please try again")
Finally
Multiview1.SetActiveView(ViewConfirmation)
If Not msg Is Nothing Then msg.Dispose()
End Try
End If
End Sub
Protected Sub Page_Load (ByVal sender As Object, ByVal e As EventArgs)
If Not IsPostBack Then
Try
Multiview1.SetActiveView(ViewForm)
Catch ex As Exception
' something bad happened
Response.Write("Something bad happened! - please try again")
End Try
End If
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:MultiView runat="server" id="MultiView1">
<asp:View runat="server" id="ViewForm">
<asp:AccessDataSource ID="AccessDataSource2bd" runat="server" DataFile="../app_data/bw_data.mdb" SelectCommand="SELECT * FROM student WHERE student_ID = 92">
</asp:AccessDataSource>
<asp:FormView runat="server" id="FormView2" DataSourceID="AccessDataSource2bd" DataKeyNames="student_ID" DefaultMode="ReadOnly">
<ItemTemplate >
<asp:Label id="first_nameTextBox" runat="server" Text='<%# Eval("first_name") %>' />,
</ItemTemplate >
</asp:FormView>
<asp:Table runat="server" id="Table2">
<asp:TableRow runat="server">
<asp:TableCell runat="server" HorizontalAlign="Left" height="20px">
<asp:Button id="UpdateButton" runat="server" CommandName="Update" onclick="btnSubmit_click" Text="Send Email"/>
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:View>
<asp:View runat="server" id="ViewConfirmation">
<p>An email has been sent, and copied to you, confirming all current contact details.</p>
</asp:View>
<p></p>
</asp:MultiView>
</form>
</body>
</html>
Thanks
Ant
Try this:
dim tb as TextBox = FormView2.Row.FindControl("first_nameTextBox")
sb.Append("Name : " + tb.Text + vbCrLf)

ServerClick not working on IP Address using Internet Explorer

My superior asked me to redirect or always use an IP based address for the web application that I created.
Ex: Instead of using http://www.google.com, the project should use
http:/ /173.194.127.46
In this way, the computers on our network could visit the webportal directly.
Unfortunately, when I use the IP, the server script on code behind doesn't work. I tried to create a simple one to prove it right.
Default.aspx
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button runat="server" ID="btnClick" Text="Test Click" />
<asp:Label ID="Label1" runat="server" Text="Label" />
<button runat="server" id="btnClick2">Test Click 2</button>
</div>
</form>
</body>
</html>
Default.aspx.vb
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub btnClick_Click(sender As Object, e As System.EventArgs) Handles btnClick.Click
Label1.Text = "Clicked from ASP Button"
End Sub
Protected Sub btnClick2_ServerClick(sender As Object, e As System.EventArgs) Handles btnClick2.ServerClick
Label1.Text = "Clicked from HTML Button"
End Sub
End Class
The code on HTML Button does not work, like it doesn't have a script.
There are html tags I placed inside the HTML Button so replacing to ASP Button will not solve it.
Is there a way I can make the codes on HTML Button work?
Update: It is working on the latest version of Google Chrome and Mozilla Firefox
I solved it but I need further testing!
Here's what I've done.
<%# Page Language="VB" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">.hid{display: none;}</style>
</head>
<body>
<form id="form1" name="form" runat="server">
<div>
<asp:Button runat="server" ID="btnClick" Text="Test Click" />
<button runat="server" id="btnClick2">Test Click 2</button>
<button runat="server" id="btnClick3" onclick="document.getElementsByTagName('form')[0].btnHidden.click();return false;">Test Click 3</button>
<asp:Button runat="server" CssClass="hid" ID="btnHidden" />
<br /><asp:Label ID="Label1" runat="server" Text="Label" />
</div>
</form>
<script type="text/VB" runat="server">
Protected Sub btnClick_Click(sender As Object, e As System.EventArgs) Handles btnClick.Click
Label1.Text = "Clicked from ASP Button"
End Sub
Protected Sub btnClick2_ServerClick(sender As Object, e As System.EventArgs) Handles btnClick2.ServerClick
Label1.Text = "Clicked from HTML Button"
End Sub
Protected Sub btnHidden_Click(s As Object, e As EventArgs) Handles btnHidden.Click
Label1.Text = "Clicked from ASP Button via HTML Button"
End Sub
</script>
</body>
</html>
What I did is add ASP Button that will trigger the server script. Then on the HTML button, I added onclick event that will perform a click on ASP Button.

What development environment setup steps am I missing?

I'm working on a database project for my school's science fair. I need to insert some data from a .aspx webform into an access database. I've been using "Microsoft Visual Web Developer" to write the following .aspx.vb code. However when I press the "submit" button it doesn't send the data to the database as it should.
What development environment setup steps am I missing?
I've been following this tutorial (http://www.youtube.com/watch?v=szm3BFSOVw0).
Here's the aspx source:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%# Page Language="C#" %>
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
}
</script>
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server"></head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Science Fair Registration</title>
<form id="form1" runat="server" class="auto-style1">
<br />
<%-- Graphics--%>
<center><h1>Science Fair Registration</h1></center>
<asp:MultiView id="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View id="View1" runat="server">
<br />
First Name:<br />
<asp:TextBox id="TextBoxSFirst" runat="server" Width="500px"></asp:TextBox>
<br />
Last Name:<br />
<asp:TextBox id="TextBoxSLast" runat="server" Width="500px"></asp:TextBox>
<br />
Student Email Address:<br />
<asp:TextBox id="TextBoxSEmail" runat="server" Width="500px"></asp:TextBox>
<br />
<br />
<br />
School:<br />
<asp:TextBox id="TextBoxSchool" runat="server" Width="500px"></asp:TextBox>
<br />
Grade:<br />
<asp:DropDownList id="DropDownListGrade" runat="server" Width="86px">
<asp:ListItem>7</asp:ListItem>
<asp:ListItem>8</asp:ListItem>
<asp:ListItem>9</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
</asp:DropDownList>
<br />
Teacher's Last Name (only):<br />
<asp:TextBox id="TextBoxTLastName" runat="server" Width="500px"></asp:TextBox>
<br />
Teacher E-mail:<br /> <asp:TextBox ID="TextBoxTEmail" runat="server"
Width="500px"></asp:TextBox>
<br />
<%-- Teacher Phone Number:<br /> <asp:TextBox id="TPhone" runat="server" Width="500px"></asp:TextBox> --%>
<%-- Might put the above in later --%>
<br />
<br />Catagory :<br /> <asp:DropDownList id="DropDownListCatagory" runat="server" Width="212px">
<asp:ListItem>Behavorial & Social Sciences</asp:ListItem>
<asp:ListItem>Biochemistry & Microbiology</asp:ListItem>
<asp:ListItem>Botany</asp:ListItem>
<asp:ListItem>Environmental Sciences</asp:ListItem>
<asp:ListItem>Medicine & Health</asp:ListItem>
<asp:ListItem>Zoology</asp:ListItem>
<asp:ListItem>Chemistry</asp:ListItem>
<asp:ListItem>Computer Science</asp:ListItem>
<asp:ListItem>Earth & Space Sciences</asp:ListItem>
<asp:ListItem>Engineering</asp:ListItem>
<asp:ListItem>Mathematics</asp:ListItem>
<asp:ListItem>Physics</asp:ListItem>
</asp:DropDownList>
<br />
Exibit Title :<br /> <asp:TextBox id="TextBoxTitle" runat="server" Width="500px"></asp:TextBox>
<br />
Does your exhibit use electricity?<br />
<%-- Possible issues here, may need to use 1 & 0 instead--%>
<asp:DropDownList id="DropDownListElectricity" runat="server">
<asp:ListItem Value="True">Yes</asp:ListItem>
<asp:ListItem Value="False">No</asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<asp:Button id="Button1" runat="server" Text="Submit" onclick="Button1_Click"
style="height: 26px" />
<br />
</asp:View>
</asp:MultiView>
</form>
</body>
</html>
Here is the aspx.vb source:
Imports System
Imports System.Data
Imports System.Data.OleDb
Partial Class _Default1
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'form data requests---------------------------------------------------------------------------------------------------------
Dim strName As String = Request.Form("First") 'In paraenthesis may be the item name in the form
Dim strLast As String = Request.Form("Last")
Dim strStudentEmail As String = Request.Form("StudentEmail")
Dim strSchool As String = Request.Form("School")
Dim numGrade As Integer = Request.Form("Grade") '*Dropdown list
Dim strTeacher As String = Request.Form("Teacher") 'Teacher's last name
Dim strTeacherEmail As String = Request.Form("TeacherEmail")
Dim strCatagory As String = Request.Form("Catagory") '*Dropdown list
Dim strTitle As String = Request.Form("Title")
Dim boolElectricity As Boolean = Request.Form("Electricity") '*possible boolean for electricity
'Open Db Connection---------------------------------------------------------------------------------------------------------
Dim strSQL As String
Dim dbconn As OleDbConnection = Nothing
dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("sf13.mdb"))
dbconn.Open();
'SQL actions ----------------------------------------------------------------------------------------------------------
strSQL = "insert into Exhibits (First, Last, School, Teacher, Title, Grade, Category, TeacherNumber, StudentEmail, Electricity, TeacherEmail) values (?,?,?,?,?,?,?,?,?,?,?)"
objcmd = New OleDbCommand(strSQL, dbconn) 'OleDbCommand should be highlighted - missing an imports....
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#First", strName))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#Last", strLast))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#School", strSchool))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#Teacher", strTeacher))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#Title", strTitle))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#Grade", numGrade))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#Category", strCatagory))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#StudentEmail", strStudentEmail))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#Electricity", boolElectricity))
objcmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("#TeacherEmail", strTeacherEmail))
objcmd.ExecuteNonQuery()
'Close DB Connection
dbconn.Close()
Response.Write("Thank you for registering")
End Sub
End Class
Fixed it
I changed the language to VB and added a "code behind tag".
<%# Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="ScienceFair.aspx.vb" Inherits="_Default" %>
It looks like you're mixing in-line coding style with code-behind. Try changing the page language to VB and specifying the code-behind class:
<%# Page Language="VB" Inherits="_Default1" %>
Also, remove the script block at the start of the file.
Further Reading
ASP.NET Code-Behind Model Overview

How to add tabPanels to tabContainer on button click

I have a tab container within an update panel. I'd like to add generated tabs to that container on a button click. The tabs get added. Once, the next time the button's clicked the previous tab is lost and a new one replaces it. I want to keep the tabs if possible. These tabs will later be filled with controls based on which button is clicked.
I've found many posts suggesting that the tabs have to be re-created on PostBack but it's not working. I don't think I know how to do it either.
My current aspx file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" ViewStateMode="Enabled">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Add Tab" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<ajaxToolkit:TabContainer ID="TabContainer1" runat="server"
ViewStateMode="Enabled">
</ajaxToolkit:TabContainer>
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Here is the code-behind so far.
Imports AjaxControlToolkit
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub WebForm1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim newTab As TabPanel = New TabPanel
Dim rand As New Random
Dim exampleID As String = rand.Next(1000).ToString
newTab.ID = exampleID
newTab.HeaderText = exampleID
newTab.Controls.Add(New LiteralControl(exampleID))
TabContainer1.Tabs.Add(newTab)
Label1.Text = Label1.Text + "<br />" + "Added tab " + newTab.ID.ToString 'Just here for output.
End Sub
End Class
I'm sure the current open tabs have to be stored somewhere and re-created on the update panel's postback but like I said. Where do I put that code and how is it stored?
Any help would be much appreciated! Thanks!

Updating ASP.NET label after button click, using UpdatePanel

I'm trying to have two things happen when I click on a button in an ASP.NET page:
Change the text in an ASP:Label.
Disable the button.
I've done a lot of research on this, but I've had difficulties doing either.
For #1, I thought that this should work, but it doesn't:
<%# Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub BtnSubmit_Click(sender As Object, e As System.EventArgs)
Label1.Text = "Working..."
System.Threading.Thread.Sleep(5000)
Label1.Text = "Done."
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Page</title>
</head>
<body>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager runat="server" />
<div>
<asp:ListBox runat="server" Height="100px" />
<br />
<asp:UpdatePanel runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnSubmit" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Press the button" />
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:Button runat="server" ID="BtnSubmit" OnClick="BtnSubmit_Click" Text="Submit Me!" />
</div>
</form>
</body>
</html>
The "Working..." message is never displayed.
As for #2, I added this to the button (I forget where I found it):
OnClientClick="this.disabled = true; this.value = 'Working...';"
UseSubmitBehavior="false"
That had the desired effect of disabling the button and changing its text (value), but it wasn't possible to change it back using Text and Enabled properties.
I just found a solution on msdn (http://msdn.microsoft.com/en-us/library/bb386518.aspx). Added some code and remove some unnecessary parts.
<%# Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void btnDoWork_Click(object sender, EventArgs e)
{
/// do something long lasting
System.Threading.Thread.Sleep(3000);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<script language="javascript" type="text/javascript">
<!--
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
prm.add_endRequest(EndRequest);
var postBackElement;
function InitializeRequest(sender, args) {
if (prm.get_isInAsyncPostBack()) {
args.set_cancel(true);
}
postBackElement = args.get_postBackElement();
if (postBackElement.id == 'btnDoWork') {
$get('btnDoWork').value = 'Working ...';
$get('btnDoWork').disabled = true;
}
}
function EndRequest(sender, args) {
if (postBackElement.id == 'btnDoWork') {
$get('btnDoWork').value = 'Done!';
$get('btnDoWork').disabled = false;
}
}
// -->
</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Hello World!"></asp:Label><br />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnDoWork" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="btnDoWork" runat="server" Text="Start!" OnClick="btnDoWork_Click" />
</div>
</form>
</body>
</html>
What you basically do, is you register some eventHandler for Initialize_ and End_Request - in those you disable and enable your button!
HTH
ASP will not flush the result to the browser while working even if you use an UpdatePanel. It will finish the jobb (including the sleep) before flushing.
You can use a UpdateProgress to show the "Working.." text.
<asp:UpdateProgress>
This will show its content while the UpdatePanel is working. Once the UpdatePanel is finished, the content will disappear.
What you need in you ClickEvent is:
Label1.Text = "Done."
btnSubmit.Enabled = false
This will show the Done text and disable the button. And tell the UpdateProgress to disappear.
The Working message is never displayed because you are executing the script on the server, which doesn't respond to the client until the method exits.
ASP.NET AJAX has a built in control for displaying messages like this while the UpdatePanel is waiting on the server.
Check out the UpdateProgress Control:
<asp:UpdateProgress runat="server" id="progress" ><ProgressTemplate>Working...</ProgressTemplate></asp:UpdateProgress>
You can disable the button by setting the Enabled property to false in your server-side method.
BtnSubmit.Enabled = false
#1: You will never see the message "Working" as you stopped the thread .... Every Message will be shown when your process has "ended".
#2: you coded clientSide to disable the button, there is no code to re-enable your button
hth
First off, "working" never appears because the final value of the label at the time of post-back is "Done." Think about what is happening here - you click the button which causes a post-back to the server. It processes the post-back which includes running the button click code, the result of which is then sent back to the browser. Your 'working' text never makes it back over the wire.
I am not clear on what you're trying to accomplish with the client-side code, but to do what you describe you're almsot there server-side:
Protected Sub BtnSubmit_Click(sender As Object, e As System.EventArgs)
Label1.Text = "Done."
btnSubmit.Enabled = false
End Sub
Also, but your button inside your update panel template tags so it participates in the ajax-postback.

Resources