Hi smile,
Refer below example.
Note: In this example i have used static property to maintain the clicked value. But in you case you need to save it in database and retrieve there to check the previous value and then increment by one.
HTML
<asp:Label ID="lblChildern" runat="server" />
<asp:Button Text="Childern" runat="server" OnClick="OnChildern" />
<asp:Button Text="Reset" runat="server" OnClick="OnResetChildern" />
<br />
<asp:Label ID="lblAdult" runat="server" />
<asp:Button Text="Adult" runat="server" OnClick="OnAdult" />
<asp:Button Text="Reset" runat="server" OnClick="OnResetAdult" />
<br />
<asp:Label ID="lblGeneral" runat="server" />
<asp:Button Text="General" runat="server" OnClick="OnGeneral" />
<asp:Button Text="Reset" runat="server" OnClick="OnResetGeneral" />
Code
protected static string Childern { get; set; }
protected static string Adult { get; set; }
protected static string General { get; set; }
protected void OnChildern(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(Childern))
{
Childern = "C-1";
}
else
{
Childern = string.Format("C-{0}", Convert.ToInt32(Childern.Split('-')[1]) + 1);
}
lblChildern.Text = Childern;
}
protected void OnResetChildern(object sender, EventArgs e)
{
Childern = string.Empty;
lblChildern.Text = Childern;
}
protected void OnAdult(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(Adult))
{
Adult = "A-1";
}
else
{
Adult = string.Format("A-{0}", Convert.ToInt32(Adult.Split('-')[1]) + 1);
}
lblAdult.Text = Adult;
}
protected void OnResetAdult(object sender, EventArgs e)
{
Adult = string.Empty;
lblAdult.Text = Adult;
}
protected void OnGeneral(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(General))
{
General = "G-1";
}
else
{
General = string.Format("G-{0}", Convert.ToInt32(General.Split('-')[1]) + 1);
}
lblGeneral.Text = General;
}
protected void OnResetGeneral(object sender, EventArgs e)
{
General = string.Empty;
lblGeneral.Text = General;
}
Screenshot