This example shows you how to bind data to DropDownList in GridView based on the Grid Row Value. In this example we will bind the States to DropDownList based on Country in Row.
In the GridView RowDataBound we will find the DropDownList and Country then fetch the state list for the Country and bind the state list to DropDownList.
Asp.net requiredfieldvalidator is used to make an input control as required field(mandatory). If you want to associate the requiredfieldvalidator to a textbox then you have to give the textbox id to requiredfieldvalidator ControlToValidate property.
Asp.net radio button is used to allow user to select any one of option among multiple. For example allowing user to select gender either male or female. And you can call server side c# code (postback) when the user select the radio button. To do that you have to specify the AutoPostBack="true" and implement the OnCheckedChanged="rbtn_CheckedChanged". Below example will let you know how to implement it.
Allowing user to select single optionTo allow user to select single option from multiple you need to set the GroupName. For example if you want to allow user to select gender either male or female then you have to set GroupName="gender" for both the radio buttons (Radio buttons which are not set the GroupName property can be selected multiple).
Reading asp.net radio button value (selected or not) in c#RadioButton.Checked property will return true value when the radio button is selected, other wise it will return false.
Calling server side code (radio button postback event) in asp.net
Asp.net checkbox is used to allow user to select multiple options. For example you are offering training for multiple technologies then you can use checkbox to allow select multiple courses. And you can call server side c# code (postback) when the user select or unselect a checkbox. To do that you have to sepecify the AutoPostBack="true" and implement the OnCheckedChanged="chbTutorial_CheckedChanged". Below example will let you know how to implement it.
Reading asp.net checkbox value (selected or not) in c#Checkobox.Checked property will return true value when the checkbox is checked, other wise it will return false.
Calling server side code (checkbox postback event) in asp.net
This example will show you how to get client/end user ip address, operating system, browser name and browser version in asp.net and c#.
CS CodeBelow c# code will get the client ip address, operating system, browser name and version details in asp.net page load event using c#.
Session state and application variable are part of Asp.net server side state management concepts. If you want to save the user specific data use session state. If you want to save the application level data then use application variable.
When your website is under maintenance then you can place the app_offline.htm page in the root folder so that any user access the website(any page) they will get the app_offline.htm page.When you have custom redirects for httpErrors in your website, you may get the message "The service is unavailable" message when you place the app_offline.htm page in your website. To resolve this issue just add the below configuration in your web.config file under httpErrors section.
When we open a website a default page will be opened. You can set which page should be opened or which is the default page in the website in web.config file. You can set the default document in defaultDocument section under system.webServer section in web.config file. Below example will let you know how to set the default document in asp.net web.config file.