Set Server controls Properties in ASP.Net



In out last asp.net tutorial we seen how to add server side control on web form in asp.net. Now after adding control on web form we have to set all controls properties and events. Each server side controls have a different types of properties and events.


Setting Server controls Properties in ASP.Net

In this asp.net post we will learn how to set properties to server control. The properties are used to design and identification purpose of controls in asp.net. let’s understand how to set properties to server side control with an example.

Here, we add a button control on web form and set properties of button control.

Button Control -> Right Click -> Properties

Now open visual studio, add new web form and then add button control on web page as shows below figure.

Setting properties to server side control in asp.net

Setting properties to server side control in asp.net

 For Open Properties windows :

Select Button Control –> Press F4 Key

Below screen shows the properties of button control, properties are like ID, BackColor, Text, Width, Height etc….

Setting properties to server side control in asp.net


View properties list in alphabetical order ASP.Net

For view the properties list in alphabetical order, click A-Z Symbol at the top of the property screen like below screen.

Set properties in alphabetical order in asp.net

Set properties in alphabetical order in asp.net


Change back ground color of button control in ASP.Net

Now, change any property from property list of button control, it will make changes on button control. If we wish to change back ground control of button control, go to BackColor property and select color as you wish.

Select Button -> Properties -> BackColor = Red

Change properties of button control in asp.net

Change properties of button control in asp.net

Same things done, when we want to change height, width or font color of button control change respective property.

Change Font color of button control in ASP.Net

For font color in asp.net we use ForeColor property to change font color of button control.

Select Button – > Properties ->ForeColor = Yellow

Change forecolor properties of button control in asp.net

Change forecolor properties of button control in asp.net

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *