We are running following javascript function:
function btn_AddToList_Click() {
var filePath = document.getElementById("FileUpload").value;
if(filePath.length > 0) {
var opt = new Option(filePath,filePath);
var listBox = document.getElementById("ListBox");
listBox.options[listBox.options.length] = opt;
}
}
Function binding:
protected void Page_Load(object sender, EventArgs e) {
if (!IsPostBack)
{
btn_AddToList.Attributes.Add("onclick", "btn_AddToList_Click(); return false;");
}
}
HTML:
asp:FileUpload ID="FileUpload" runat="server" Width="394px"
asp:ListBox ID="ListBox" runat="server" Width="394px"
asp:Button ID="btn_AddToList" runat="server" Enabled="true" Text="Add"
Issue is that value of "FileUpload" is not get cleared after we click "Add" button. Any help?