You can code like this:
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="cmdUpLoad" runat="server" Text="UpLoadFile"
OnClick="cmdUpLoad_Click"
OnClientClick="changemylabel();return true"
/>
<br />
<br />
<asp:TextBox ID="TextBox1" runat="server" ClientIDMode="Static"
style="border-color:transparent"
></asp:TextBox>
<script>
function changemylabel() {
mytbox = document.getElementById("TextBox1")
mytbox.value = "The text is changed when upload button hit"
}
</script>
But why did I use a text box in place of a label? Well, a label does not preserve its view state when you hit the upload button (a post back) due to client side changes (but server side it does!!!). Thus, when the file up-loads, and page cycle completes, then the value of what you changed client side code wise to the label will be lost. In other words, changing the label with client side JavaScript will not persist. However, with a text box, they are designed to accept changes client side (by you typing, or by JavaScript code changing the value of that text box). Hence, I used a text box, since I wanted the value changed by JavaScript to survive the post-back (page round trip). However, if you wanted to clear the label when you hit upload (and it will clear client side), then on server side code in your upload button code stub, you also have to clear the label, since as noted changes to a label ONLY go into viewstate with server side code, and not client side code.