Showing posts with label ASP.NET Example for Beginners. Show all posts
Showing posts with label ASP.NET Example for Beginners. Show all posts

How to Show or Hide LinkButton Control in Asp.Net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on LinkButton(or drag and drop LinkButton on Design view)->Right click on LinkButton->Select Properties->change LinkButton Text Property to "This LinkButton will hide when Button Click"


3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to  Hide LinkButton
->Also change Button two Text property to  Show LinkButton
Your Design Window should look like this 
asp.net LinkButton Control Show or Hide Example







4.Double click on Button1(Hide LinkButton Button) to get the code behind->Write this code
5.Double click on Button2(Show LinkButton Button) to get the code behind->Write this code
6.Click F5 to run your project.
asp.net LinkButton Hide or Show Example
    










asp.net LinkButton Hide or Show Example











asp.net LinkButton Hide or Show Example
 

How to Set or Change Label Control Border Width Programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.ToolBox-> Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to Label Control Border Width Set or Change Example

3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to  Border Width 2
->Also change Button two Text property to  Border Width 4
Your Design Window should look like this 
Set Label Border width






4.Double click on Button1(Border Width 2 Button) to get the code behind->Write this code
5.Double click on Button1(Border Width 4 Button) to get the code behind->Write this code
6.Click F5 to run your project.
Set label Border Width programmatically











Set label Border Width programmatically












Set label Border Width programmatically
 

How to Show or Hide Label programmatically in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.From ToolBox Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to This Label will Hide when Button Click

3.ToolBox->Drag and Drop Two Button on design window->Right click on Button one->select properties->(look for text property) change text property from Button to  Hide Label
->Also change Button two Text property to  Show Label
Your Design Window should look like this 
Show or Hide Label














4.Double click on Button1(Height50 Button) to get the code behind->Write this code
5. Double click on Button2(Height100 Button) to get the code behind->Write this code
6.Click F5 to run your project.
Label Hide or Show Programmatically
  




Label Hide or Show Programmatically











Label Hide or Show Programmatically
 

How to use ToolTip in Label Control in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.From ToolBox Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to Label Control ToolTip Example->Set ToolTip property to   ToolTip on Label Control
ToolTip in Label Control







ToolBox->Drag and Drop a Label to Design window->Right click on label->select properties->(look for text property) change text property from label to This is a ToolTip Example->Set ToolTip property to  
 ToolTip Example two

3.Click F5 to run Your project
ToolTip property on label control










ToolTip property on label control

How to checked RadioButton Control when Page Load in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


 2.ToolBox-> Double Click on Label(or drag and drop Label on Design view)-> Right click on Label->Select Properties->change Text properties to  Select your Gender?


3.ToolBox-> Double Click on RadioButton->Right click on RadioButton->Select properties->Change text properties to Male

ToolBox-> Double Click on RadioButton->Right click on RadioButton->Select properties->Change text properties to Female 
Your Design window should look like this
RadioButton Control Design window















4. Right click on Male RadioButton(RadioButton1)->View code(to get the code behind)
And write this code

5.Click F5 to run your project
RadioButton Control Page Load
 

How to call and use OnCheckedChanged Event in RadioButton in Asp.Net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


 2.ToolBox-> Double Click on Label(or drag and drop Label on Design view)-> Right click on Label->Select Properties->change Text properties to  Select your Gender?

3. ToolBox-> Double Click on RadioButton->Right click on RadioButton->Select properties->Change text properties to Male->AutoPostBack properties to True->GroupName properties to RadioButtonControl
RadioButton Control Properties





















  ToolBox-> Double Click on RadioButton->Right click on RadioButton->Select properties->Change text properties to Female->AutoPostBack properties to True->GroupName properties to RadioButtonControl

4.ToolBox-> Double Click on Label-> Right click on Label->Select Properties->change Text properties to
 Blank(delete the label text so when you  run nothing will show)
 Your Design window should look like this
RadioButton Control Design window












5.Right click on Male RadioButton(RadioButton1)->properties->Click Events->Double click on CheckedChanged events(to get the code behind)











And write this code:

6..Right click on Female RadioButton(RadioButton2)->properties->Click Events->on CheckedChanged events DropDownList select RadioButton_CheckedChanged(it is the event name which we created on our first RadioButton's CheckedChanged Event)

7.Click F5 to run your project.
RadioButton Control  Output
After Running the project















When Male RadioButton Control Event
After clicking Male RadioButton












When Male RadioButton Control Event
After Clicking Female RadioButton

How to Add a Calender to a PlaceHolder Control in asp.net Programmatically using C#

 PlaceHolder Control is used like a container in which we can add other controls.It has no visual output.
The Placeholder does not render any tags for itself, so it is great for grouping content without the overhead of outer HTML tags.

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2. Click ToolBox-> Double Click on PlaceHolder(or drag and drop PlaceHolder on Design view)->

ToolBox-> Double Click on Button->Right click on Button->Select Properties->Change Text Properties to "Add Controls to PlaceHolder"-> Your Design Window should look like this













3.Double click on Button to get the code behind(or Right click on Button->select Properties->Click Events->Double Click on Click Events)->Now write this code
4.Click F5 to run your project->OK
After Running the project
















After clicking the Button the calender is shown on PlaceHolder

How to use Hyperlink Navigate Url in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on HyperLink(or drag and drop HyperLink on Design view)->Right click on HyperLink->Select Properties->change HyperLink Text Property to "aspdotnet-park Blog"

 Change the NavigateUrl  properties to your desired url name/link(here i write http://aspdotnet-park.blogspot.com/)

(You can write your projects form name like "Default.aspx")
HyperLink NavigateUrl in asp.net

3.Click F5 to run your project->ok
Hyperlink NavigateUrl



How to use Literal Control in asp.net

Literal and Label control are same except that Literal Control does not allow you to apply a style to the displayed Text.

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.Click ToolBox-> Double Click on Literal(or drag and drop Literal on Design view)->change Literal Text Property to "Literal Test"

3.Click ToolBox-> Double Click on Button->change Button Text Property to "Click to change text"
asp.net Literal Control
Your design Window should look like this
 4.Double Click on the Button to get the code behind and write this code
5.Click F5->ok
Literal Control in asp.net
After Running the project



















Literal Control Text change programmatically
After Clicking the Button (Literal text is changed)

How to Add Item in RadioButtonList in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.ToolBox-> Double Click on RadioButtonList(or drag and drop RadioButtonList on Design view)-> click arrow sign(Vertical arrow on image) -> click Edit Items->you will promt a popup window
RadioButtonList Control






























 3.Click Add to add new Item to your RadioButtonList-> Change the Text to your desired item name->Ok
RadioButtonList control

































 4.Click F5 to run your project->Ok
RadioButtonList Control output

How to Add Item in BulltedList Control in ASP.NET

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.ToolBox-> Double Click on BulletedList(or drag and drop BulletedList on Design view)-> click arrow sign(Vertical arrow on image) -> click Edit Items->you will promt a popup window
BulletedList Control













3.Click Add to add new Item to your BulletedList-> Change the Text to your desired item name->Ok
BulletedList Control example




























4.Click F5 to run your project->Ok
BulletedList Control final result

How to Add Items in CheckBoxList in vs2010

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)

2.ToolBox-> Double Click on CheckBoxList(or drag drop CheckBoxList to Design Window)-> click Arrow sign->Click Edit items->
CheckboxList Control
CheckBoxList

















3.Click Add(to add new item)->Change Text to your desired item name(if you select Selected to true then it will always remain selected)-> Ok
Add Item to CheckBoxList


































4.To Run your Project Click F5->Ok
Our Final CheckBoxList With Added Item
Our Final CheckBoxList With Added Item

How To Create a Website in Visual Studio 2010 And Adding a New Web Page

1.File->New->Click Website

Creating a Website in Visual Studio 2010
Creating a Website in Visual Studio 2010









2.(left side select visual c#) ASP.NET Web Site->ok
Adding a Web Form
Adding a Form











3.Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->
Add New Web Form(Webpage)
Add New Item

4.Select Web Form(you change your page name)->click Add
Adding Web Form
Adding New Web Form

5.Now You Will see Source View. To see source view and Design view simultaniously click Split.To see only Design View Click Design. Now You can Design your page as you like.


How to Add Items in DropDownLoad List in ASP.NET

I believe that one image solves a lot of question.so i am trying to use more image so Beginners can understand my article easily.

1.File->New->Click Website
 

































































































































Creating a website



2.(left side select visual c#) ASP.NET Web Site->ok

How to Add Item in ListBox control in asp.net

1.File-> New-> Website->  ASP.NET Web Site(Visual C#) -> Ok

(Now You will see a Default.aspx page. To create your own page->click on dropdown list below Edit->click Add new item->Select Web Form->click Add)


2.ToolBox-> Double Click on ListBox(or drag and drop ListBox on Design view)-> click arrow sign(Vertical arrow on image) -> click Edit Items->you will promt a popup window
ListBox Control in asp.net3.Click Add to add new Item to your ListBox-> Change the Text to your desired item name->Ok

ListBox Control in asp.net

































 4.Click F5 to run your project->Ok
ListBox Control in asp.net output