Skip to main content

Posts

asp.net - Deselect Calendar selected date on second click

Deselect Calendar selected date on second click Calendar is an asp.net rich web server control that provide us a way to select an individual dateor date range. this example code demonstrate us an interesting technique to deselect calendar selected date on second click. first click on any date cell we can select a date from calendar control and we can change the selection of calendar date by selectinganother date or date range from calendar control. calendar server control has no built in feature to deselect selected date on second clickand it has no feature to select random date from calendar control. to select random date from calendar control and deselect selected date on second click we need to apply few techniques.to do this we created an event handler for calendar SelectionChanged event. we stored the calendar selected dates in a bulletedlist items collection.when users click a date in calendar control then we test it that the buletedl...

asp.net - How to add custom text to a day cell in a Calendar

Add custom text in Calendar Individual Day Cell Calendar is an ASP.NET web server control. Users can select an individual date or date range in a Calendar control. Calendar OnDayRender() method raises the DayRender event of calendar control that allows us to write a custom handler for the DayRender event. The Calendar DayRender event occurs when each day is created in the control hierarchy for the Calendar control. We can add static control to a calendar’s specific date cell before Calendar display in a web browser such as Literal, Image, and Hyperlink control. ASP.NET Literal server control reserves a location on the web page to display static text. So if we can add a Literal control on the Calendar individual date cell then we can add any static text to any date cell in the Calendar control. First, we need to create a Literal control programmatically in the DayRender event handler section. Then we add static text to Literal control which we...

asp.net - How to apply css style on Calendar individual day cell

Apply CSS style in Calendar individual Day Cell Calendar is an ASP.NET web server control. This web server control allows us to select an individual date or date range at a time. Calendar control is rendered as an HTML table and each day of Calendar control contains a LinkButton control that raises an event when it is clicked. Calendar control has many built-in properties to set or change its day cell's text color, background color, border style, etc. But Calendar control has no property to change its individual day cell or any specific day cell styles programmatically. The Calendar DayRender event occurs when each day is created in the control hierarchy of the Calendar control. So it is possible to change the style of any individual day cell in Calendar control before it displays in the web browser. By using this event we can modify the appearance of a specific day cell or multiple cells before it displays on the web page. The Cale...

asp.net - How to use Calendar DayRender event

Calendar DayRender event The Calendar is an ASP.NET web server control that allows us to select an individual date or date range. The Calendar displays the dates for one month at a time with a total of six weeks appearing at the same time. In an ASP.NET web page Calendar server control is rendered as an HTML table. By default, each day of Calendar control contains a LinkButton control that raises an event when it is clicked. The Calendar DayRender event occurs when each day is created in the control hierarchy of the Calendar control. DayRender event is raised when each date cell in the Calendar control is created. So it is possible to modify the date cell content and format the individual date cells before it is displayed on the web page. We can write an event handler for the Calendar DayRender event to customize the content and appearance of any specific date cell or cells. We can add only static control to any date cell such as Literal, Labe...

asp.net - How to use Calendar SelectionChanged event

How to use Calendar SelectionChanged event in asp.net Calendar is an asp.net rich web server control. calendar control displays the dates for one month at a time. total six weeksappearing at the same time. users can select an individual date from calendar control. even users can select multiple dates (date range)from a calendar server control. calendar SelectionChanged event occurs when the users select an individual date or range of dates. by using this event we can determinewhat date or dates the user has selected. we can write an event handler for calendar SelectionChanged event to display user selecteddate or dates in web page after postback. to get the calendar selected dates we loop through the calendar SelectedDates collection using for loop and display the selected date liston web page. the following asp.net c# example code demonstrate us how can we use the calendar SelectionChanged event in an asp.net application. Calenda...

c# - How to create a DataTable from a DataView

DataView ToTable() method .Net framework's DataView represents a data bindable, customized view of a DataTable for filtering, sorting, searching, editing, and navigation. DataView does not store any data, it represents a connected view of its corresponding DataTable. DataTable represents one table of in-memory data. DataView ToTable() method has four overloaded methods, those are ToTable(), ToTable(String), ToTable(Boolean, String[]), and ToTable(String, Boolean, String[]). DataView ToTable() method creates and returns a new DataTable based on rows in an existing DataView. This method return value type is System.Data.DataTable which represents a new DataTable instance that contains the requested rows and columns. This method returned DataTable contains the same columns as the input table. Returned DataTable name is also the same as the source DataTable. DataView ToTable(String) overloaded method also creates and returns a DataTable bas...

c# - How to add a new row to the DataView

Add a new row to a DataView The DataView is a customized view of a DataTable for sorting, filtering, searching, editing, and navigation. The DataView does not store data. When the asp.net developer changes the DataView's data that will affect the DataTable. But when they change the DataTable's data that will affect all associated DataViews. The DataView is much like a database view. The following asp.net c# tutorial code demonstrates how we can add a new row to a DataView. Here we used the DataView class AddNew() method to add a new row to a DataView instance. The DataView class AddNew() method adds a new row to the DataView. The AddNew() method returns a new DataRowView object. The DataRowView class represents a customized view of a DataRow. After adding the row to the DataView we can insert data into the row for specified columns. The DataRowView class EndEdit() method commits changes to the underlying DataRow and ends the edit...