Backstage:
//需要定义权限,public或protected,如何不定义默认是internal类型的,前台取不到
public string SumGold = "";
protected void Page_load(object sender, EventArgs e)
{
SumGold = "2";
}
Front desk:
<a>金币总数:<%=SumGold%></a>
Another is to dynamically generate buttons based on the value passed in the background, and assign the value to the Text property
background:
public string flag= "";
protected void Page_load(object sender, EventArgs e)
{
//flag的赋什么值自己写
Button btn = new Button();
btn.ID = "Button1";
btn.Text = flag;
btn.Click += new System.EventHandler(this.btnSave_Click);
form1.Controls.Add(btn);
}
protected void btnSave_Click(object sender, EventArgs e){
}
Front desk:
<body>
<form id="form1" runat="server>
</form>
</body>