Skip to main content

Posts

How to use Panel control in asp.net

Panel Web Server Control The Panel is an asp.net web server control. Panel control act as a container control for static text and other controls. The Panel works as a parent control for other controls on a web page. Panel control is very useful when you want to create content programmatically and want to insert it into a web page. Panel control is a container for controls that you want to create at a run time programmatically. We can put controls in a Panel and manage them as a group of controls. So we can show or hide all controls inside a Panel by setting the Panel Visible property. Panel's DefaultButton property can define a default button for the panel container. Panel's Height and Width properties help us to create a specific-size container. Then we can show scroll bars by setting the Panel's ScrollBars property. ScrollBars property has five possible values those are None, Horizontal, Vertical, Both, and Auto. ScrollBars propert...

How to populate a CheckBoxList from SqlDataSource in asp.net c#

Populate a CheckBoxList from SqlDataSource CheckBoxList is an asp.net web server control that provides a multi-selection CheckBox group. CheckBoxList control support data binding. so we can populate CheckBoxList with items from a data source control. To bind CheckBoxList control to a data source, first, asp.net developers need to create a data source control such as ObjectDataSource, LinqDataSource, SqlDataSource control, etc. DataSource control contains the items to display in the CheckBoxList. After creating the DataSource control, developers can call the CheckBoxList DataBind method to bind the DataSource to the CheckBoxList control. This method allows developers to programmatically (dynamically) data bind CheckBoxList control at run time. CheckBoxList control's DataTextFiled and DataValueFiled properties specify which field in the data source to bind to the Text and Value properties of each list item in CheckBoxList control. ChecBox...

How to use CheckBox control in asp.net c#

CheckBox Server Control The CheckBox is an asp.net web server control. A CheckBox allows the website visitor to select (check) a true or false condition. So the CheckBox control creates a CheckBox on the web forms page which allow the user to switch between a true or false state. CheckBox Text property creates a caption for it. We can left or right-align the caption by using the CheckBox TextAlign property. The CheckBox control has many properties that help us to change looks and styles such as ForeColor, BorderColor, BackColor, BorderStyle, BorderWidth, CssClass, EnableTheming, Font, Height, SkinID, ToolTip, Width, etc. If we want to determine whether CheckBox is checked (selected) then we need to test the CheckBox Checked property. CheckBox AutoPostBack property value true enable automatic posting to the server. CheckBox CheckedChanged event is raised when someone changes the CheckBox true or false state. The .NET developers can write an event handler f...

How to use button click event in asp.net c#

Button OnClick() method and click event The Button is an asp.net web server control. This control displays a push button control on the web page. Button server control exists under System.Web.UI.WebControls namespace. Button control allows the users to post a page to the web server. By default, a Button control is a submit button. Button OnClick() method raises the click event of the Button control. The Button Click event occurs when the button control is clicked. The click event is commonly used when button control has no associate command name such as a submit button. We can specify a Button's command name by its CommandName property. Submit Button does not have a command name and it simply posts the page back to the web server. We can write an event handler for the click event to programmatically perform any action when submit Button is clicked. The following asp.net c# example code demonstrates to us how can we use click event i...

How to use ListBox in asp.net c#

ListBox Web Server Control The ListBox is an ASP.NET list web server control. ListBox control renders a list box that allows single or multiple-item selection. ListBox SelectionMode property gets or sets the selection mode of ListBox control. SelectionMode property has two possible values those are Single and Multiple. ASP.NET developers can programmatically change the ListBox selection mode by setting the ListSelectionMode enumeration value. Multiple modes specify that multiple items can be selected from ListBox control. ListBox Row property gets or sets the number of rows displayed in ListBox. That means the Row property specifies the height of ListBox control. ListBox has an Item collection that contains all ListItem objects. each ListItem object represents an item in ListBox control. We can add or remove ListItem programmatically at run time in ListBox. We can populate a ListBox with items at design time using declarative syntax by p...

How to use FileUpload control in asp.net c#

FileUpload Web Server Control FileUpload is an ASP.NET web server control that allows users to send (upload) a file from their computer to the server. Uploaded file submitted to the server as part of the Web Browser request during PostBack. The user only can upload files whose size is below the maximum allowed file size. The .NET developers can set the uploaded file's maximum size by setting the MaximumRequestLength configuration value. We can test the FileUpload control's HasFile property to check whether the FileUpload control has an uploaded file. Page developers also can control the uploaded files MIME type and extension. Developers can only accept the specific MIME types files and those files which have the specific extension. The PostedFile property gets the underlying HttpPostedFile object for the uploaded file. Using FileUpload control's PostedFile property we can access additional properties on the uploaded file. We can get ...

asp.net - How to select a date range from a Calendar

Select date range form calendar Calendar is an ASP.NET web server control. Calendar control displays the dates for one month at a time and a total of six weeks appear at a time. Users can select an individual date or multiple dates (date range) from Calendar server control. By default, Calendar control is enabled for date selection. each day of the Calendar contains a LinkButton control that raises an event when it is clicked. The Calendar SelectionMode property gets or sets the date selection mode on the Calendar control. Selection mode specifies whether the user can select a single day, a week, or an entire month from a Calendar server control. Calendar SelectionMode property value type is System.Web.UI.WebControls.CalendarSelectionMode. We can set the SelectionMode property value from one of the values of the CalendarSelectionMode enumeration. The default value of this property is 'Day' which means a user can select a single d...