Posted on: 1/3/2015 1:55:43 AM | Views : 555

I'm building a user control that has a server-side property called "Mode".  It's possible values are 1, 2, 3, 4, etc.  This property is being set inline when the user control is defined.
I need to pass the value of Mode down to the client-side.  I'm currently doing that with a hidden field:
<asp:HiddenField ID="hfMode" runat="server" /> I then wish to use Javascript to examine the value of "hfMode" when the user control is initialized and will turn on / off various DIVs accordingly.
I'm currently doing that like this:
<script type="text/javascript"> $(document).ready(function () { Initialize(); } function Initialize() { if (typeof hfMode === 'undefined') alert('Mode not set on ShipDateSelector control!') else { var mode = getElementById(hfMode); ...

Go to the complete details ...