I'm kind of newbie in C#.net . Im doing a form post on Client side which post a csv to my Controller
in My controller I'm unable to read the value. My goal is to finally create a csv file hence I'm avoiding the ajax post. I have the action on my form directing to the correct Url and Im appending the input to the form.
I have something like this on my client side
WatchList_Class.prototype.Downloads1 = function(csv) {
var input = '<input type= "text" id="uploadCsv" name="uploadCsv" value=""' + csv + ' />';
$('form#uploadCSV').append(input);
$('form#uploadCSV').submit();
};
On the controller side I have
public ActionResult ExportCSVFile(string data) //Im getting data as null
{
string toReturn = Server.UrlDecode(data);
return File(System.Text.Encoding.UTF8.GetBytes(toReturn), "text/csv", "exportedData.csv");
}
Im getting string data as null;
Can Any one point out what Im doing wrong. Thanks in advance
datawill be entirely predicated on your having a form element with a name ofdatasomewhere on the client. Nothing in the code you provided indicates one way or another that you have such an element.