| |

VerySource

 Forgot password?
 Register
Search
View: 10|Reply: 3

Ask AjaxPro.net masters, how to get the variable value in the cs code.

[Copy link]

1

Threads

1

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-3-22 18:30:01
| Show all posts |Read mode
A variable was declared in the background code, and now the same variable is also required in the JavaScript code of aspx. I don't want to declare one in the background and then declare one in the foreground. I want to get this in the background directly.
Explore it for yourself:
...
private int _size1 = 30;
...
[AjaxPro.AjaxProperty]
public int Size1
{
get {return _size1;}
}
Use the space name.class name.PageSize in the foreground; the call is found to be undefined
Searching AjaxProperty on the Internet for Baidu has only one result, google does, but the website is basically unable to open. I have to trouble everyone.

Please master help. Thank you.
Reply

Use magic Report

0

Threads

6

Posts

2

Credits

Newbie

Rank: 1

Credits
2

 China

Post time: 2020-7-1 15:15:01
| Show all posts
You can output this variable in js format in the background, and then use it directly in the foreground.
Same as using js variables.
Reply

Use magic Report

0

Threads

15

Posts

12

Credits

Newbie

Rank: 1

Credits
12

 China

Post time: 2020-7-7 06:45:01
| Show all posts
Where is PageSize?

[AjaxPro.AjaxMethod]
public int Size1()
{
return 30;
}
You can call directly at the front desk
Reply

Use magic Report

0

Threads

4

Posts

4

Credits

Newbie

Rank: 1

Credits
4

 China

Post time: 2020-7-7 21:45:01
| Show all posts
<%=Size1%> Can't it be adjusted?
ice185013also works the same way
But don’t forget to declare
Ajax.Utility.RegisterTypeForAjax(typeof(PageSize));
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list