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 insert,Update,Delete data in a Database using DataSet and show data in a GridView

If you are new to ADO.NET then I will suggest you to see my previous article
How to add DataSet and Add Database table to a DataSet


We will start from our previous article where we create a dataset and put two tables on that dataset.
1.(To find your DataSet)Solution Explorer->Click on App_Code smart tag->You will see your DataSet->Double click on Dataset so that it will show on Design window.

2.Right Click on your desired table(here Login table)->Add->Click Query->Next(Make sure Use Sql Statements is selected)->Select Insert->Next->(It's optional you can click Query Builder to see your query is working properly->Click Execute Query->Insert your value->Ok->You will see a message one row affected->Ok->Ok)->Next->Next->Finish
Insert data to a Database using DataSet












3.Add a new windows form->Add two label,two textbox and a Button->Also add a Gridview->
Your Design window should look like this
Insert Data Into database with database using c#
4.Click smart tag of your GridView->Select New DataSource
Asp.net GridView









Select Object->Ok->Select your Table Adapter->Finish->Checked the CheckBox Enable Sorting,Editing,Deleting,selecting(as your requirement)

5.Double click on the Button(Insert button)->And write this code


6.Click F5 to run your project

Insert Data into DataBase and Shown in a GridView


How to add DataSet and Add Database table to a DataSet

Before continue to this article I suggest you to see my previous article where i discuss about database table
How to Create a Database table in Visual Studio 2010

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

2.Click Add New Item(shown on image)->










Select DataSet(you can change the DataSet name)->Click Add->Yes(now you will see a window)

















3.Click Solution Explorer->Double Click on your  Database Name->Double click on Tables->(you will see your table list)->Drag and Drop your table to DataSet window->Click Yes(By this way add your all table one by one to DataSet window)
(Click Save Before you leave this window otherwise you will not get the DataSet)


How to Create a Database table in Visual Studio 2010

If  You are new in asp.net database related work then i suggest you first go through this article
How to Create a Database/Connect to a Database in Visual Studio 2010

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

2.Click Solution Explorer-> Double click on Your Database->Your window should look like this.





















Right Click on Tables->Click Add New Table(You will look a window like this)
















*Column Name:Here you will write your attribute name
*Data Type:You will select your data type by clicking the drop down list
*Allow Nulls:If you checked the check box then you must have to put data when inserting.(primary key didn't allow nulls) .
















To set primary key->Right click on User_id(black arrow beside User_id)->click Set Primary Key

Click ctrl+s(or click save to save your table)-> you will promt a window->Write your desired table name(here i write Login)->Ok

(To see your table add or not)->click solution explorer->click table(you will see your table list)
In this way you can add more Tables as you want.

















If you have any problem with this article, please just leave a comment.

How to Show or Hide Panel Control Programmatically in asp.net using c#

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 Panel(or drag and drop Panel on Design view)->You can increase your Panel Width and height by clicking the sign(shown on arrow)->Right click on Panel->Select Properties->Change BorderStyle property to Solid(this is your panel border style)
Your Design Window should look like this















ToolBox->Double click on Button->Right click on Button->select properties->Change Text properties to "Show Panel" (Place your Buttons Outside Panel)

ToolBox->Double click on Button->Right click on Button->select properties->Change Text properties to "Hide Panel"

3. Double Click on Button1(Show Panel Button)->Write this code
4.Double Click on Button2(Hide Panel Button)->Write this code
5.Click F5 to run your project->OK
















Panel Control is Hidden now

Panel Control is Shown When the Show Panel Button Clicked








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

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 















 

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

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