| |

VerySource

 Forgot password?
 Register
Search
View: 892|Reply: 4

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

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 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.00

Credits

Newbie

Rank: 1

Credits
2.00

 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

18

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 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

15

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 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

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-3 16:15:01
| Show all posts
I also encountered this problem, just change the attribute to the method, otherwise the output will always be undefined
Reply

Use magic Report

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

Points Rules

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

Quick Reply To Top Return to the list