Wednesday, January 14, 2009

Adding Items in ListBox

OutPut:



















HTML Code:



C# Source Code:

int HiddenValue;

protected void Button1_Click(object sender, EventArgs e)
{
HiddenValue = Convert.ToInt32(HiddenField1.Value.ToString());
ListBox1.Items.Add("Item " + HiddenValue.ToString());
Label4.Text = HiddenValue.ToString();
HiddenValue = HiddenValue + 1;
HiddenField1.Value = HiddenValue.ToString();
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
TextBox1.Text = ListBox1.SelectedItem.Text.ToString();
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...