public partial class MainBookingform : System.Web.UI.Page
{
static int numberOfBeachBookingInteger = 0;
static int numberOfBushBookingInteger = 0;
static int totalRevenueInteger = 0;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["beachBach"] != null)
{
numberOfBeachBookingInteger += 1;
beachBachLabel.Text = numberOfBeachBookingInteger.ToString();
}
if (Session["beachBach"] != null)
{
numberOfBushBookingInteger += 1;
bushBachLabel.Text = numberOfBushBookingInteger.ToString();
}
}
}
嗨,我希望看到這些整數以「0」開始,當我調試程序。然而,這些標籤我分配到這些整數總是從「1」靜態Int不從0開始
請幫助!
的標籤賦予它們的值之前,務必遞增來,你是怎麼想到會發生? – cadrell0
當然是。你增加1! numberOfBushBookingInteger + = 1; – gsharp
這兩個if應該具有相同的條件嗎? – cadrell0