I need to store the filename in either Session or Viewstate in design page of asp.net
and should use in codebhind C# by inheriting session or viewstate value.
When i Use like following in viewstate,it is considering viewstate as null in codebehind.
how to rectify this error
<script language="javascript" type="text/javascript">
function GetFileName(fileUp) {
var gv = document.getElementById("<%=gv.ClientID %>");
var gvRowCount = gv.rows.length;
var rwIndex = 2;
var inputs = gv.getElementsByTagName("input");
var c;
for (var j = 2; j < gvRowCount; j++) {
var filePath = fileUp.value;
var filename = filePath.replace(/^.*[\\\/]/, '');
c = gv.rows[j].cells[15];
document.getElementById(c.childNodes[5].id).innerHTML = filename;
document.getElementById("<%=hidden_field.ClientID %>").Value = filename;
alert(document.getElementById("<%=hidden_field.ClientID %>").Value);
ViewState["hidden_field"] = filename;
}
return false;
}
</script>