要素のonClientClick
プロパティを使用してみてください。asp:button
例、.aspx ファイル:
<script type="text/javascript">
function myFunction()
{
alert('hi');
}
</script>
...
<asp:button id="Button1"
usesubmitbehavior="true"
text="Open Web site"
onclientclick="myFunction()"
runat="server" onclick="Button1_Click" />
そして、コード ビハインド (.aspx.cs) で
void Button1_Click (object sender, EventArgs e)
{
if (this.FileUpload1.HasFile)
{
this.FileUpload1.SaveAs("c:\\" + this.FileUpload1.FileName);
}
}
詳細はこちら
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick.aspx