Because the recent project needs just contact with ASPNET, the pop-up function in the FileUpload control in the ASPNET is encountered in the context of the need for a client popup dialog box, without knowing what third-party controls are. The whole process has some curve meaning of saving the nation.
Overall idea:
Hide FileUpload, button Two ASP controls, the input button to trigger the FileUpload click event, and then through the FileUpload onchange event triggers the button's Click event, invoke the background code.
<asp:fileupload clientidmode= "Static" id= "FileUpload1" runat= "Server" onchange= "document.getElementById" (' Button2 '). Click (); style= "Visibility:hidden"/>
<input id= "Button1" button "type=" Select File "value=" button " class=" document.getElementById (' FileUpload1 '). Click () "/> <asp:button id=" Button2 "clientidmode="
Static "runat= "Server" style= "Visibility:hidden" text= "button" onclick= "Button1_click_test"/>
Follow up business operations in background events
protected void Button1_click_test (object sender, EventArgs e)
{
<span style= "White-space:pre" > </span>response.write ("<script>alert (' Test ') </script>");
<span style= "White-space:pre" > </span>//Operations on files Fileupload1.filename
}
When you use document.getElementById to get an ASP control, you use control Id.clientid to discover that sometimes you can't get specific controls, and here I set ClientIDMode as static and use the control ID number directly as a way to find it. Also note that when you hide the control, you need to use style= "Visibility:hidden" If you set visible to False, the event cannot be triggered.