| |

VerySource

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

ascx is called by aspx, how to call variables in ascx in aspx

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-2-24 13:30:01
| Show all posts |Read mode
form1.ascx (user-defined control)
public class head
public aa as string
end public

form2.aspx
<mycontrols: header id = "ctrlHeader" Runat = "Server"> </ mycontrols: header>

form2.aspx.vb
ctrlHeader.aa = "" Description: Reference the AA variable in FORM1.ascx
The ctrlHeader variable appears undeclared.
What's wrong with it? Seems to refer to imports in form2.aspx.vb, please elaborate
Reply

Use magic Report

0

Threads

7

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-5-8 17:00:01
| Show all posts
Turn it into an attribute you can call
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-5-8 19:45:01
| Show all posts
ctrlHeader should be declared manually.

protected form1 ctrlHeader;
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-5-9 02:45:01
| Show all posts
form1 ctrlHeader = this.Page.FindControl ("ctrlHeader");
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-5-15 10:30:01
| Show all posts
None of the above methods, I tried
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