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();
}
ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting. ASP.NET supports three different development models: Web Pages, MVC (Model View Controller), and Web Forms.
Tuesday, July 29, 2008
TextBox Control
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text = "You have clicked the button";
TextBox4.Text = "This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. ";
TextBox3.Text = TextBox2.Text;
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "The Text is changed.";
}
{
TextBox1.Text = "You have clicked the button";
TextBox4.Text = "This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. This is a multi line textbox. ";
TextBox3.Text = TextBox2.Text;
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox1.Text = "The Text is changed.";
}
Literal Control
protected void Button1_Click(object sender, EventArgs e)
{
Literal1.Text = "Welcome to ASP.NET 2.0";
}
{
Literal1.Text = "Welcome to ASP.NET 2.0";
}
Label Control
Source Code is:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Label Text changed";
Label1.BorderStyle = BorderStyle.Dotted;
Label1.BackColor = System.Drawing.Color.Aqua;
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Visible =!(Label1.Visible);
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Label Text changed";
Label1.BorderStyle = BorderStyle.Dotted;
Label1.BackColor = System.Drawing.Color.Aqua;
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Visible =!(Label1.Visible);
}
HiddenField Control
Html Code is:
asp:HiddenField ID="HiddenField1" runat="Server" Value="Welcome to ASP.NET 2.0"
Visible="False"
Source Code is:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = HiddenField1.Value;
}
asp:HiddenField ID="HiddenField1" runat="Server" Value="Welcome to ASP.NET 2.0"
Visible="False"
Source Code is:
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = HiddenField1.Value;
}
File Upload Control
Source Code:
protected void Button1_Click(object sender, EventArgs e)
{
if( FileUpload1.HasFile)
{
FileUpload1.SaveAs("C:/projects/" + FileUpload1.FileName);
Label2.Text = "File Uploaded";
}
else
Label2.Text = "No uploaded file";
}
protected void Button1_Click(object sender, EventArgs e)
{
if( FileUpload1.HasFile)
{
FileUpload1.SaveAs("C:/projects/" + FileUpload1.FileName);
Label2.Text = "File Uploaded";
}
else
Label2.Text = "No uploaded file";
}
Subscribe to:
Posts (Atom)
Using Authorization with Swagger in ASP.NET Core
Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models { ...
-
Output: using Microsoft.VisualBasic; using System; using System.Collections; using System.Collections.Generic; using S...
-
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.D...
-
<?xml version="1.0" encoding="utf-8"?> <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting...