my Code is below
@Ajax.ActionLink("Choose File",
"chooseItemView",
new { },
new AjaxOptions
{
UpdateTargetId = "replaceDiv",
InsertionMode = InsertionMode.Replace,
HttpMethod = "GET",
//OnBegin = "startPreLoader",
OnSuccess = "stopPreLoader",
OnFailure = "stopPreLoader"
}, new
{
@id=1,
@type="file",
@class="btn btn-primary offset-top-2",
/*@id=item.GetHashCode().GetHashCode(),
* onclick = "fileUploadFunction('" + item.GetHashCode().GetHashCode() + "')"*/
onclick = "fileUploadFunction('" + 1 + "')"
})
public ActionResult chooseItemView()
{
/*MessageBox.Show("Hi");*/
OpenFileDialog openFileDialog=new OpenFileDialog();
openFileDialog.Multiselect = false;
openFileDialog.Filter = "txt files (*.txt)|*.txt| DOC files (*.doc)|*.doc";
openFileDialog.ShowDialog();
return PartialView("_UploadItemView",null);
}
there is a exceoption when run this as below
"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."
so how can i solve this?