ASP.NET
ASP.NET

0 344
https://youtu.be/mpU_-Qd-1io

How to use Image Control in ASP.NET

In my previous article I have described about Label Control, Button Control, CheckBox, CheckBoxList, RadioButton, RadioButtonList, ListBox and many other controls. In this article I will describe that How to use Image Control in ASP.NET.

What is Image Control

Image Control is a standard control which resides in Toolbox in Visual Studio (VS) Framework. This control is simply used to insert any image in the web form. To insert image control simply double click on it or drag it in your web form. When you insert this control then following coding appears in your source page.

 

 

This is the default coding which appears. In the above coding the ID of the control is a unique identifier which can be modified by you as per your desire, but remember the new identifier which you want to set must be unique. Now Follow the following steps that how to insert image in the web form.

Steps to Insert Image in the Web Form

  1. To use Image Control to insert image in your web page first you have to upload any image in the root directory or any other directory. For instance we create a directory (folder) namely images for this purpose. For this right click on Solution name in your VS Framework and the click on new folder, there you may insert any desired name (e.g. images) and then press enter. Now again right click on this folder and then click on add existing item to insert images from your system. (Also view this video)

 

 

 

  1. ImageUrl Property: This property is used to insert the desired image to your web form. To insert the image give the path of the image to this property. Watch the following video also.

 

 

 

 

  1. AlternateText Property: This property is used to set alternate text for the image. This is very useful property and one must add this property. You may type the text related to the image in this propery. If you insert a home image then the text may be “this is an image of home”. This is useful for On Page SEO purpose.

 

That is all about image control in brief. We will come back with more useful article very soon for you.

0 464
what is radiobuttonlist control and how to use it in asp.net

What is RadioButtonList Control and how to use it in ASP.NET

RadioButtonList is a standard control like other controls like RadioButton, Button, CheckBox, CheckBoxList, Label, ListBox, DropDownList etc. In this article I will describe that what is RadioButtonList and how to use it in ASP.NET. Like RadioButton control RadioButtonList control is also used to select only single values out of multiple values. User can select only one value from the RadioButtonList control.

 

How to insert RadioButtonList control in ASP.NET

To insert RadioButtonList control in your web form first click on the toolbox in your Visual Studio (VS) Framework and then either double click on the RadioButtonList control or drag it your web form to insert it. When you will insert it in your web form then the following coding will appear automatically.

 

 

In above coding the ID of the control generates automatically with the default name. You may change it as per your need. Now the next question is that how can we insert items in the list. So just consider the following coding and also see the video…

 

 

Properties of CheckBoxList Control

 

  1. RepeatDirection

In above coding when you will run the program then it will be shown in vertical view by default. To view the list in horizontal view you can use RepeatDirection property of this control. This property has 2 values namely horizontal and vertical. When you set the value to horizontal then the list shows in horizontal view.

  1. RepeatColumn

This property is used to show RadioButtonList items in Columns. Suppose you want to show RadioButtonList in 2 or 3 columns as per your need then you may provide RepeatColumn an integer value like 2 or 3.

  1. RepeatLayout

This property has 2 values namely Flow and Table. When Flow layout is used then items of RadioButtonList shown in a flow means there is no alignment among them, while in Table layout the items of RadioButtonList are shown in the table view. Each item is shown in a column and a row with proper alignment. You may change between both layouts and can feel the change. To understand all above 3 properties just consider the following coding and run that.

 

 

  1. AutoPostBack

When this property is set to true then on clicking (check or uncheck) the RadioButtonList control, page postback to server. Postback to server means that the request goes to server to reload the page. This property should be set to true when we require performing any task on clicking the checkbox control and for this we can use SelectedIndexChanged Event to handle this task.

 

  1. SelectedIndexChanged Event

 

SelectedIndexChanged event is used to handle any task when someone clicks on the RadioButtonList item. To create SelectedIndexChanged event just go to the property of the RadioButtonList and click in the SelectedIndexChanged textbox and press enter. On pressing enter an event with the default name will be generated. If you want to give any name to this event then type the name of the event and then press enter. Just consider the following coding and also watch the video to understand this….

 

 

 

Note: To execute above event AutoPostBack property of the control must be set to true.

 

These are the basic features of RadioButtonList control. In my next article I will describe the detailed use of this control. That is all for now. Have a happy coding….

0 350
how to use radiobutton control in asp.net

What is RadioButton Control and how to use RadioButton Control in ASP.NET

RadioButton is a Standard Control which found in Toolbox in Visual Studio (VS) Framework. In this article I will describe that What is RadioButton Control and how to use RadioButton Control in ASP.NET. RadioButton control is  used to select a single value out of many. User can not select more than one value at a time. RadioButton control is always used in group. We will discuss all the details step by step.

How to insert RadioButton Control

To insert RadioButton control first click on toolbox and then either double click on RadioButton control or you may drag it to your web form. When you insert this control in your web form then following coding automatically appears:

 

 

In above coding Default ID automatically generates which you may change as per your desire. Now our next step is to insert items. Consider the following coding and also watch the video for more details:

 

 

Remember that the value of GroupName Property for each control will be same. If this value differs than the RadioButton Controls will be treated separated.

 

 

Property of RadioButton Control

 

  1. AutoPostBack

When this property is set to true then on clicking (check or uncheck) the RadioButton control, page postback to server. Postback to server means that the request goes to server to reload the page. This property is set to true when we require to perform any task on clicking the checkbox control and for this we can use CheckedChanged Event to handle this task.

  1. CheckedChanged Event

CheckedChanged event is used to handle any task when someone clicks on the RadioButton item. To create CheckedChanged event just go to the property of the RadioButton and click in the CheckedChanged textbox and press enter. On pressing enter an event with the default name will be generated. If you want to give any name to this event then type the name of the event and then press enter. Just watch the following video to understand this….

 

 

  1. Checked

This property has 2 values namely true and false. When this property set to true then the control remains checked and when this is set to false then the control remains unchecked.

 

  1. OnCheckedChanged

In RadioButton property you may see CheckedChanged event. But when you create this event then in source page the event create with the name OnCheckedChanged while in aspx.cs page the event creates with the name CheckedChanged. Watch above video carefully. You may handle CheckedChanged event in this segment

RadioButton is not very typical control. I have discussed all main features of this control in this article. In my next article I will describe that how  we can use RadioButton Control in programming. Till then happy coding…

 

 

 

 

 

0 423
how to use checkboxlist control in asp.net

What is CheckBoxList Control and how to use it in ASP.NET

CheckBoxList is a Standard Control which resides in toolbox in Visual Studio (VS) Studio Framework. In this article i will describe that what is CheckBoxList control and how to use it in ASP.NET.  To insert this control in your web form simply double click on it or drag it to the web form. When you insert it in your web form then the following coding appears in the source page of the web form.

 

 

In the above coding you may change the ID of the control as per your requirement. Now the next step is to insert items in this CheckBoxList. To insert items in CheckBoxList you have to type the following coding. Also watch the following video for more details…

 

 

 

You may see that there are 2 attributes namely Text and Value. Text attribute is used for caption purpose i.e. it provides the text appearance to the item. On the other hand Value attribute is used to provide a unique identifier to each item so that it can be accessed in programming using this value. Value attribute is provided in Positive Integer (Natural Number) format only.

Properties of CheckBoxList

  1. RepeatDirection:

This property is used to give horizontal or vertical view to CheckBoxList. This property has 2 values namely Horizontal and Vertical. Consider the following coding and run it in your VS framework…

 

 

In above coding change RepeatDirection values and consider the change.

  1. RepeatColumn

This property is used to show CheckBoxList in Columns. Suppose you want to show CheckBoxList in 2 or 3 columns as per your need then you may set the value of RepeatColumn property to an integer value like 2 or 3. Consider the following coding and run it.

 

 

Above coding will produce 2 columns CheckBoxList. To produce 3 columns CheckBoxList you may set RepeatColumn value to 3 end so on.

  1. RepeatLayout

This property has 2 values namely Flow and Table. When Flow layout is used then items of CheckBoxList shown in a flow means there is no alignment among them, while in Table layout the items of CheckBoxList are shown in the table view. Each item is shown in a column and a row with proper alignment. You may change between both layouts and can feel the change.

 

  1. TextAlign

This property is used for alignment. It has 2 values namely Left and Right. Run the following coding and feel the change.

 

 

  1. AutoPostBack

When this property is set to true then on clicking (check or uncheck) the CheckBoxList control, page postback to server. Postback to server means that the request goes to server to reload the page. This property is set to true when we require to perform any task on clicking the checkbox control and for this we can use SelectedIndexChanged Event to handle this task.

     6. SelectedIndexChanged Event

SelectedIndexChanged event is used to handle any task when someone clicks on the CheckBoxList item. To create SelectedIndexChanged event just go to the property of the CheckBoxList and click in the SelectedIndexChanged textbox and press enter. On pressing enter an event with the default name will be generated. If you want to give any name to this event then type the name of the event and then press enter. Just watch the following video to understand this….

 

 

That is all about CheckBoxList for now. But we will return with more logic about this control very soon. till then happy coding… 🙂

0 404
how to use checkbox contro in asp.net

What is Checkbox Control and how to use it in ASP.NET

Hello guys! I hope you will be well there. Today in this article I will describe that What is checkbox control and how to use it in ASP.NET. So let’s first have a discuss that what is checkbox control and how to use it in ASP.NET, and then we will describe how to insert it in a web form and their properties. So we start now…

What is checkbox control

Checkbox control is a standard control which resides in toolbox menu in Visual Studio (VS) Framework.  Checkbox control is used to select any single value like I Agree checkbox in any web form. Checkbox returns true or false value depending on its selected state. If checkbox is selected then it will return true value else it will return false value.

How to insert checkbox control in web form

To insert checkbox control in any web form just click on toolbox in VS Framework and then either double click on checkbox control or drag it in your web form to insert it. When you insert checkbox control in your web form then following coding shows automatically.

<asp:CheckBox ID=”CheckBox1″ runat=”server” />

In above coding you may change the value of ID to any value you want. Now the next step is give a caption value to this checkbox control. For this we use the Text Property of checkbox control. Suppose you want to give a caption value I Agree all terms and conditions , then update the above coding with the following…

        <asp:CheckBox ID=”CheckBox1″ runat=”server” Text=”I Agree all terms and conditions” />

 

Now if you run the program then you will see a checkbox with caption “ I agree all terms and conditions”.  So this is the basic concept of checkbox control in asp.net.  Now we will discuss some more properties of this control.

Properties of checkbox control

  1. Properties related to Appearance

Checkbox control has some basic properties related to its appearance like ForeColor, BackColor, BorderColor, Font etc.  You may give any value to these value either in source page by manual typing the following coding or you may switch to design page and then right click on the control, then click on properties. You will see the properties panel, from there you may set any value you want and I would like to reveal here that my preferred method is from design mode. Just consider the following coding and then watch the following video to understand this…

 

  1. AutoPostBack

When this property is set to true then on clicking (check or uncheck) the checkbox control, page postback to server. Postback to server means that the request goes to server to reload the page. This property is set to true when we require to perform any task on clicking the checkbox control and for this we can use Checkedchanged Event to handle this task.

 

  1. Checkedchanged Event

Checkedchanged event is used to handle any task when someone clicks on the checkbox. To create checkedchanged event just go to the property of the checkbox and click in the checkedchanged textbox and press enter. On pressing enter an event with the default name will be generated. If you want to give any name to this event then type the name of the event and then press enter. Just watch the following video to understand this….

 

Remember one thing: checkedchanged event only works when you set autopostback property to true.

In this article I have discussed most common and basic features of checkbox control. In our next article I will discuss that how to use checkedchanged event and how can we use its other properties in programming. That’s all for now… happy coding….

 

 

0 411

ListBox in ASP.NET is a Standard Control which is used to display a list of items as the name implies. Out of these ltems we can select only one or many items as required.

What is ListBox Control and how it is used in ASP.NET – Step by Step Guide

ListBox in ASP.NET is a Standard Control which is used to display a list of items as the name implies. Out of these ltems we can select only one or many items as required.

Now,  first we will teach you that how we can insert this user control in our web form. To insert this user control in your web form follow these steps:

  1. First click on Toolbox in your Visual Studio (VS) Framework. When you will click on Toolbox then you will see many user controls and out of them you will also see ListBox control under Standard Control. Just drag it to your web form or double click on it. When you insert ListBox Control in your web form, then following coding will appear:

<asp:ListBox ID=”ListBox1″ runat=”server”></asp:ListBox>

  1. Now we will insert items in this ListBox. To insert items in this ListBox there are 2 ways. First is from .aspx page and another is from .aspx.cs page.
  2. Inserting Items from .aspx page:

To insert Items from .aspx page click between closing tag of asp:ListBox and opening tag of /asp:ListBox and then when you type “<” (opening tag) then automatically asp:Listitem appears then you may insert the items as below:

<asp:ListItem Text=”India” Value=”0″></asp:ListItem>

 

To understand the whole concept so far watch this video:

 

 

Suppose you want to a Listbox which is used to select countries. So the whole coding will be shown as below:

<asp:ListBox ID=”ListBox1″ runat=”server” Width=”200px”>

        <asp:ListItem Text=”India” Value=”0″></asp:ListItem>

        <asp:ListItem Text=”China” Value=”1″></asp:ListItem>

        <asp:ListItem Text=”USA” Value=”3″></asp:ListItem>

        <asp:ListItem Text=”Nepal” Value=”4″></asp:ListItem>

</asp:ListBox>

In above coding Value field shows the index of each item which is used in programming to access the item.

When you view this page in explorer then you will see a ListBox with 4 Options and out of them you can select only one.

  1. Inserting Items from .aspx.cs page:

 

There is an another method to insert items in ListBox and that is using .aspx.cs page. For this first Insert the ListBox Control in web form which looks like as below:

<asp:ListBox ID=”ListBox1″ runat=”server”></asp:ListBox>

Now to insert items in this ListBox just move to .aspx.cs page. In .aspx.cs page first click on Page_Load event then to insert countries just type the following coding:

protected void Page_Load(object sender, EventArgs e)

    {

        ListBox1.Items.Insert(0, “India”);

        ListBox1.Items.Insert(1, “Pak”);

        ListBox1.Items.Insert(2, “China”);

        ListBox1.Items.Insert(3, “USA”);

    }

To understand this logic, watch this video:

 

 

Remove any Item from ListBox:

To Remove any item from .aspx.cs page we use RemoveAt property of Listbox. For example if you want to delete China from the above list then we will use it’s index value to delete it. The index value of first item is 0, second item’s index value is 1, third items’s index value is 2 end so on. So it is clear that index value of China is 2. So the following coding will delete the item China from the list.

        ListBox1.Items.RemoveAt(2);

 

Append any new item to the end of the list

If you want to append any new item at the end of the list say Singapore then following coding will do it:

 

        ListBox1.Items.Add(“Singapore”);

 

Removes all items from the ListBox

 

To remove all items from the ListBox use the following coding:

 

        ListBox1.Items.Clear();

 

Count the Numbers of a ListBox

 

To count the total number of a list box use the following coding

 

ListBox1.Items.Count

 

The output will be 5 when you will run the program.

 

Selecting Multiple Items:

 

To select multiple items add SelectionMode=”Multiple” as below:

 

<asp:ListBox ID=”ListBox1″ runat=”server” Width=”200PX” SelectionMode=”Multiple”></asp:ListBox>

 

That’s it about ListBox Control in Brief. We will describe more about ListBox control in another article. Happy coding.

 

0 454

Fundamental about button control in asp.net and their uses.

How to use Button Control in ASP.NET

In this article I will give you detailed information about how to use button control in asp.net, their types and uses.

Button controls are used to submit the form data to server. Form data may be any registration form, Login form, I Agree agreement or any thing else. When we click on button control then an incident happens and that is called “postback”. I will tell you about postback in this article later. First let’s understand that how many types are there of button control and how it is used in a web form. E t

The button control is of 3 types.

  1. Button
  2. LinkButton
  3. ImageButton

All these controls are same in behavior the only difference is in their appearance. Button control and LinkButton control are given text value for their name while ImageButton control is given an image URL to give a visual look. Let’s first understand the behavior of button control which is same, then we will understand the difference among them.

Behavior of button control in asp.net

Let’s insert a button control in a page, then give a line break and then insert System Date and Time below it. To insert a button control click on Toolbox and then either drag button control to your web form or double click on it. When you insert a button control in your web form then it looks like as below:

<asp:Button ID=”Button1″ runat=”server” Text=”Button” />

In above coding you may change the ID and Text value to your desired value. Now give a line break. After line break we will insert a label control and we will give current date and time to this label programmatically. The whole coding in web form is as below:

 

<asp:Button ID=”Button1″ runat=”server” Text=”Button” />

<br />

<asp:Label ID=”date-time” runat=”server”></asp:Label>

 

Now just turn to .aspx.cs page to give some hands to programming. The programming coding will be as below ( The Programming section will be discussed in another article):

protected void Page_Load(object sender, EventArgs e)

{

lbldatetime.Text = DateTime.Now.ToString();

}

Now when you run the program then you see a button with text Button and current date and time below it. Now note the date and time in your mind up seconds. When you click on button control after few seconds then notice the difference. You will find that when you click on button control then page reloads and the time changes. You may see that each time you click time change to current date and time. It means that button control submit the web form to the server each time we click on it. This is the fundamental behavior of each button control either it is button control, LinkButton control or ImageButton control. Now let’s study some common properties of button controls.

onclick: This event is a server side event and it is used to fire any coding. After page load when we want to execute any particular coding then we can do that using onclick event. To create onclick event for a button control just turn to design mode and then right click on button interface and then click on property. In property window click on event category in top right and then you may see Click under Action heading. Now click on attribute section and press enter. After pressing enter onclick event generates and the control transfers to .aspx.cs page. In .aspx.cs page you may see the following coding:

protected void Button1_Click(object sender, EventArgs e)

{

 

}

View the following video to understand this trick.

 

Another button type is LinkButton control. It has a property CommandName and CommandArgument which will be discussed later in details in another article. It’s coding is as below:

 

<asp:LinkButton ID=”LinkButton1″ runat=”server”>LinkButton</asp:LinkButton>

 

And the last one is Imagebutton control. When you insert this control from toolbox then its coding looks like as below:

<asp:ImageButton ID=”ImageButton1″ runat=”server” />

To assign image to this imagebutton just follow the following coding:

 

<asp:ImageButton ID=”ImageButton1″ runat=”server” ImageUrl=”~/images/facebook.jpg” />

To understand the working of above coding follow the following video:

 

That’s all about button control in brief. We will more describe button control in another article. Happy coding 🙂

 

0 249

In ASP.NET some time we need some control that can be used for collecting information from the user. ASP.NET has some control for collecting user information and out of these controls one control is text box control. So we can say that the text box control is information collector control.

 

How to use text box control – Step by Step Guide

 

First click on toolbox list  shown in your Visual Studio (VS) Framework. Then you may see text box control there. Just drag this control to your web form or you may double click on it to insert in your web form. When you insert text box control in your web form then you may see following coding:

 

<asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox>

 

When you run this very very simple program then you may see an empty text box on your web page.

 

Properties of text box control

 

Text box control has various properties. Let’s study them here.

 

  1. TextMode: This property is used to change the text mode of a text box. Text box attribute has 3 values MultiLine, Password and SingleLine.

 

<asp:TextBox ID=”TextBox1″ runat=”server” TextMode=”MultiLine”></asp:TextBox>

 

When textbox TextMode value is set to MultiLine then textbox is shown in the form of a multiline textbox. This is used when large piece of content is required to fetch from user like address, description or any other lengthy information.

 

 

When TextMode value is set to Password then the textbox is used to get password from user. This is used in login form in a web form.

 

And the last one is SingleLine value. This is default value. If you don’t use TextMode property then by default the TextMode is SingleLine, so there is no need to write this manually.

 

MaxLength: This attribute is used to fix the length of textbox. This attribute is given any integer number as value. If it is set to 50 then in textbox no more than 50 characters can be added.

 

ReadOnly: This attribute has to values namely true and false. If it is set to true then user can not type anything in textbox else he can write in it.

 

Text: This attribute is used to write any thing in textbox by default.

 

TabIndex: This attribute is used when textbox are accessed from tab key. TabIndex are given Positive Integers values like 1,2,3,4 etc. If there are 2 or more than 2 textbox and they have TabIndex value 1,2,3,4 respectively then when we press tab key then cursor moves from textbox having TabIndex value 1 to TabIndex value 2 and then to TabIndex value 3 end so on.

 

Columns and Rows: This property of textbox control is used to set the length of height of a textbox indirectly. The number of columns is equal to characters which are enter in the textbox. Similarly rows are the number of lines of textbox in which user can input the data.

 

Besides there are some common properties like width, height, font, Visible, Enabled are also there which are not required to discuss here.

 

Following is some sample coding

 

<asp:TextBox ID=”TextBox1″ runat=”server” TextMode=”MultiLine” MaxLength=”50″ TabIndex=”2″></asp:TextBox>

        <asp:TextBox ID=”a12″ runat=”server” TabIndex=”3″ ></asp:TextBox>

                <asp:TextBox ID=”TextBox2″ runat=”server” TabIndex=”1″ ></asp:TextBox>

 

That’s all textbox control in brief. Happy coding J

 

 

0 272

What is Drop down List (DDL) in ASP.NET

The Drop down List is a Standard Control in ASP.NET which is used to List many values in single list. One can select any one option out of the options in the list. Drop down List can be used in place of Radio Button. The difference is only that Radio Button acquires some space on webpage while Drop Down List acquire lesser space than Radio Button Control.

How to use Drop down list – Step by Step Guide:

  1. First Click on Toolbox List in your Visual Studio (VS) Framework and then either drag Drop down list control in your web form or double click on it.
  2. When you insert Drop down list (DDL herein after) in your web form the following coding shows in source of the web form.

<asp:DropDownList ID=”DropDownList1″ runat=”server”> </asp:DropDownList>

 

  1. In above coding the ID of DDL control may be DropDownList1 or it can be DropDownList2 or DropDownList3 or any thing else, because if already any DDL control with the ID DropDownList1 already exists then the smart VS Framework change the ID to DropDownList2 and if DropDownList2 exists then ID is changed to DropDownList3 end so on.
  2. Now the next step is to insert items in the DDL Control. There are 2 ways to insert the items in DDL Control.
  3. First method:

<asp:DropDownList ID=”DropDownList1″ runat=”server”>

<asp:ListItem Text=”India” Value=”0″></asp:ListItem>

<asp:ListItem Text=”Pakistan” Value=”1″></asp:ListItem>

<asp:ListItem Text=”Nepal” Value=”2″></asp:ListItem>

<asp:ListItem Text=”China” Value=”3″></asp:ListItem>

<asp:ListItem Text=”Singapore” Value=”4″></asp:ListItem>

</asp:DropDownList>

 

In above coding you may see two attributes of DDL control namely Text and Value. The Text control is used to show the item in web form. The Value control is used to provide a unique value to each Text value of the control so that this item can be used in programming. There are 2 more attributes of DDL control. Consider the following line of coding.

<asp:ListItem Text=”India” Value=”0″ Enabled=”true” Selected=”True”></asp:ListItem>

 

The Enabled attribute is used to enable or disable the item in the list. If this attribute is set to true then the item can be selected otherwise it cannot be selected. The other attribute is selected. It has 2 values True and False. If this attribute has a value True then this Text Item will be selected by default. You may use this attribute only once with any item because at one time only one value can be selected.

6.Second method:

Just click on the design mode showing in the bottom of your web form just before to split option. Now you can see the control interface in design mode. Just right click on it and click on properties. Now in properties list you may see various options and out of these options you may see “Items” option. You may see that the Collection is written in the attribute part of this option. Just click on this and you may see List Item Collector Editor pop up box. Now click on the Add button and fill the details. Finally click on OK button. Now you have done it. In this way it is coding less method to create a drop down list. When you move to coding page then you may see the same coding as above in method one. So it is your choice what method you like to use to create Drop down list. That’s it drop down list in brief. happy coding 🙂

0 366
what is label control and how to use in asp.net

How to use Label Control in ASP.NET

Label in asp.net is a very simple control. Label Control is a non clickable control that means we cannot click on it for any response.Label Controls are used to show any information and it can be changed programmatically. Label control can be used with checkbox, radiobutton, button or any other control for notation purpose. In this article i will describe that How to use Label Control in ASP.NET.  To use Label Control in your program follow these steps:-

  1. Click on Toolbox List visible in your asp.net framework.
  2. Drag Label control in to the web form. You may also double click on it to insert in your web form
  3. Now you may see following code line in the source page of your web form.

In above coding asp: Label shows about the control that it is a Label control. ID=”Label1” shows that the Unique Identity name of this control is Label1. You may change it with your desired name. If the Label is related to marks of a student in any exam then you may put the name of this ID just like “StudentMarks” or “SMarks” etc. next attribute is runat=”Server” which means that this control will be execute on Server. The next field is Text=”Label”, here you may write the text which you want to show on your webpage. For example we want to show the text “Marks in Maths = 75”. So in this way the above text will be look like as below:-

 

This is the basic concept of Label Control. Now if you are using Visual Studio 2008 then you may see Split option in the bottom of your web form page in VS (Visual Studio) Framework. Split option is only available in VS 2008 or higher version. In VS 2005 this option is not available. Now just right click on the Label control in Design mode and click on properties. Now you may see more options so that you can customize Label control in your way. For example you may change ForeColor, background color, width, height and text value etc. Visible control is used to show or hide the control. If it is set to True then control will be visible else invisible.

Run the Program

Now you may run the program. To run the program there are 2 ways. First way is that, Just click on Build menu and click on build solution. Short cut key is F6. The second ways is that just click on solution explorer in the VS Framework and right click on the web form you want to run, and then click on “view in browser” drop down option.

Here is another instance of Label control with different attributes.

Just run this coding and understand the logic. Thanks a lot to read this article. Have a happy coding….

 

 

 

Follow us