In my ASP.NET website, I have to add browse file from file upload window, but for some design sake Textbox and Button control has used in the page.
<asp:Button ID="Button1" runat="server" onclick="Button1_Click1"
Text="Button" />
<input type="file" runat="server" id="myfile"/>
Display of this file upload control is none..
I used Jquery plugins in the header tag as below,
<head>
--
<script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript">
</script><script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
</head>
And in my server side code , in the button click event I have code as below,
protected void Button1_Click1(object sender, EventArgs e)
{
StringBuilder strScript = new StringBuilder();
strScript.Append("$(document).ready(function(){");
strScript.Append("('myfile').click();");
strScript.Append("});");
Page.ClientScript.RegisterStartupScript(this.GetType(), "Script",
strScript.ToString(), true);
}
The above code is not opening the fileupload window. Please give some suggessions.