这很好用,问题是我希望在许多页面上都这样做,并且不想一直重复与类通信的CS代码。
ASPX页面中的变量引用:
<%:countVal %>
后面的代码:
public string countVal = "";
protected void Page_Load(object sender,EventArgs e)
{
reviewCount count = new reviewCount();
countVal = count.reviewCounts().ToString();
}
和方法:
public int reviewCounts()
{
int fbCount = 10;
int googleCount = 10;
int total = fbCount + googleCount;
return total;
}
是否可以跳过中间的跳过并操纵此<%:countVal %>
以直接从类中获取数据?
是C#的新词,很抱歉,答案是盲目的。