You must Sign In to post a response.
  • Category: JQuery

    Use variable instead of hiddenfield in jquery

    Hi all,

    in my application iam using hiddenfields for storing values.

    during testing the application ,i found that every one can change the value of hiddenfield in browser and crack the application.

    so iam thinking of hiddenfield with varibles using jquery.

    currently iam setting the value of hiddenfield using c# like this

    in load event

    hddate.Value = newyear;
    hfdate.Value = nyear;
    hdfval.Value = fval;

    here hddate,hfdate and hdfval are hiddenfields .

    my requirement is declare varible using jquery.


    var hddate;

    var hfdate;

    var hdfval;

    how to set value to these varible in c# file like above


  • #765222
    Hi Baiju,

    If you want to assign value to variable using Jquery then simply assign it.

    var obj="value";

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #765228
    without using Hidden you can use 'ViewState', it is also a clientside state management technique which used to hold values during page PostBack,
    Additionally you can use Session variable to store values
    Other way is to Encrypt your value before storing it in hidden fields
    if your information is sensitive then I will recommend to use server side state management techniques like Session or Application variable

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765234
    Use ViewState.
    You can see Hidden fields value through 'view source' function of browser.
    The values in ViewState are invisible when 'view source', they are automatically compressed and encoded.
    Hope it helps.
    Shashikant Gurav

  • #765238
    Why can not you try the ViewState?. ViewState is the technique to handle the values in hidden manner.
    By Nathan
    Direction is important than speed

Sign In to post your comments