c# - Static Int not start at 0 -
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(); } } }
hi, see these integer start @ "0" when debug program. however, these label assign integers start @ '1'
please help!
before write numbers label, increment them:
numberofbeachbookinginteger += 1;
so of course value in labels never 0.
Comments
Post a Comment