简体   繁体   中英

how to access values from a class file in javascript

I have defined some variable with values in my settings.cs class. Is there any way to access value in javascript class.

Here is my varaibles I defined in settings.cs

 public static class BinaryPosition
    {
        public const string ParentIDQueryStringVariable = "test";
        public const string PlacementQueryStringVariable = "testing";
    }

How to access value of ParentIDQueryStringVariable and PlacementQueryStringVariable in .js file.Thanks!!

You can simply output the variables/values to hidden form fields on page load:

<input type="hidden" id="variable_name" runat="server" />

Page_Load:

variable_name.Value = [Your Var Value];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM