Baruch Barness

Baruch Barness

  • NA
  • 3
  • 2.3k

Passing Client value to server

Sep 3 2010 1:53 PM

I need to pass a client value to a server control. I use the code below:

------------- code start ----------------    
1. <script language="JavaScript" type="text/javascript">
2.         function StoreFileName(elem)
3.         {
4.           alert(elem.value);
5.              var filename='<%=txtFileName.ClientID %>'
6.              filename.value=elem.value;
7.              alert(filename.value);
8.            }
9. </script>   
          .
          .
          .
10. <input id="txtFileName" type="hidden" runat="server" />
------------- code end ----------------

When I run the code above, the alert on line 4 displays correct value, the alert on line 7 displays 'nothing'. I expect the filename.value in line 6 to have the same value as the elem.value. Does any one know what is wrong with this code and how can I pass this client value to the server?

 
 

Answers (2)