vasu

vasu

  • NA
  • 6
  • 2.7k

increment a alphanumeric numeric value on button click

Mar 5 2014 7:38 AM
How to increment a variable that is alpha numeric for every button click and display the incremented value for every increment.
 If i am having a variable named Order number that is intialised to 1 and it should be concatenated to ABC like ABC1 and it should be incremented by 1 for every button click the code in C# is as follows:
 
 
ViewState["count"] = Convert.ToInt32(ViewState["count"]) + 1;
label1.Text = ViewState["count"].ToString();
if (OrderID >= 10000000)
{
CompleteOrderId = string.Concat(Prefix, OrderID.ToString());
if(CompleteOrderId.Length<=11)
label2.Text = CompleteOrderId.ToString();
OrderID++;
if (label1.Text != null)
{
(CompleteOrderId + 1).ToString();
DisplayOrderID.Text = CompleteOrderId.ToString();
DisplayOrderID.Visible = true;
}
here it is displaying the count of button click but not incrementing the completeorder ID number . Kindly help me with this. Thanks in advance
 

Answers (3)