|
|
September 10, 2009
Click Here to download the latest version of CalendarExtender Plus and documentation.
The CalendarExtender Plus is a modification of the calendar extender that ships as part of the Ajax Control Toolkit. There are two main features added to the control. First, you can limit the selectable dates to a specified date range. Second, there is now the option to show an alternate header. The new header includes two DropDown Lists, one to select the month and one to select the year.
(more…)
August 25, 2009
Scenario
Among the controls on a page is an update panel with a button that when clicked causes a partial postback that takes at least a few seconds. During this time you want to show the user a wait message that will disappear as soon as the postBack completes.
(more…)
August 12, 2009
Question
Under normal circumstances when a page loads with a tabContainer on it one tab must be selected. The selected tab can be specified via the ActiveTabIndex property. What if the tabContainer needs to default to an empty tab with none of the tabs selected?
Solution
Add a dummy tabPanel to the tabContainer and leave it blank. Use the pageLoad JavaScript function to hide the tab’s header
<cc1:TabContainer ID="TabContainer1" runat="server"
Height="200px" Width="200px" ActiveTabIndex="0">
<cc1:TabPanel runat="server" ID="tpDummy" HeaderText="">
<ContentTemplate>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel runat="server" ID="tpName" HeaderText="Name">
<ContentTemplate>
Name:
<asp:TextBox runat="server" ID="txtName" />
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel runat="server" ID="tpEmail" HeaderText="Email">
<ContentTemplate>
Email:
<asp:TextBox runat="server" ID="txtEmail" />
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer> |
function pageLoad(sender, e)
{
var objTpDummy =
document.getElementById('<%= tpDummy.ClientID %>' + '_tab');
objTpDummy.style.display = 'none';
} |
August 10, 2009
Scenario
A page has a list of images for the user to choose from. When a file is selected the request is processed via an AJAX call that directs the source of an iFrame to another page where the image is generated and passed back to the client.
Due to the size of some of the images, the generation can take a noticeable amount of time. To make sure the user does not think the site is frozen a wait message is needed. Since the generating page only returns the image, we need another way to notify the client when the file is generated and the wait message can be hidden.
(more…)
June 16, 2009
|
Click Here to download the latest version of CalendarExtender Plus and documentation.
The CalendarExtender Plus is a modification of the calendar extender that ships as part of the Ajax Control Toolkit. There are two main features added to the control. First, you can limit the selectable dates to a specified date range. Second, there is now the option to show an alternate header. The new header includes two DropDown Lists, one to select the month and one to select the year.
|
The available dates can be limited using the MaxDate and MinDate properties.
<cc1:CalendarExtenderPlus runat="server" ID="cepExample"
TargetControlID="txtExample"
MaximumDate="01/01/2009" MinimumDate="5/15/2009 /> |
Setting the ShowDdlHeader to true will show the heading with dropDownLists to select the month and year.
<cc1:CalendarExtenderPlus runat="server" ID="cepHeaderExample"
TargetControlID="txtExample" ShowDdlHeader="true" /> |

The Calendar Extender Plus has a few other enhancements, including the ability to show or hide the arrows in the heading to move back and forth a month, and a property to show or hide today’s date at the bottom of the calendar.
Since the CalendarExtender Plus is a modification of the standard extender it has all the properties and functionality of the original. It can be skinned using the normal css, and automatically fills the textBox with no need for additional javascript.
The CalendarExtender Plus is free to download, use, and distribute with your project. Any feedback is greatly appreciated!
June 7, 2009
The Issue
The comboBox has a couple of server side events to deal with field changing.
- OnSelectedIndexChanged
- OnTextChanged
How can we catch the comboBox changing on the client side?
The Solution
Without access to these function on the client side, we need to use the client side events of the textBox that is contained within the comboBox. As with any textBox this one also has the onChange event, but the event does not run when the text was changed and the focus moved to another field. There are a few options:
- onKeyPress
- onKeyUp
- onBlur
The problem with onKeyPress is when it gets to the javascript function the value of the textBox is has not changed yet, leaving onKeyUp and onBlur. While onKeyUp will give the desired effect when the user presses a key on the keyboard, part of the point of a comboBox is the ability to use the mouse, which will not be captured by this event, leaving onBlur as the remaining option. It’s still not perfect, since the event won’t run until the focus is moved off the comboBox, but it appears to be the best option. In some cases you may want to use both onKeyUp and onBlur to get the best of both events, but be careful because when the user uses the keyboard and the moves the focus your event will run twice.
In the example below I have a comboBox named cmbExample and a javascript function that accepts the textBox calling it as a parameter, cmbExample_OnBlur(textBox). I add the onBlur event to the textBox in the Page_Load method in the code behind.
protected void Page_Load(object sender, EventArgs e)
{
TextBox textBox = cmbExample.FindControl("TextBox") as TextBox;
if (textBox != null)
{
textBox.Attributes.Add("onBlur", "cmbExample_OnBlur(this);");
}
} |
May 14, 2009
February 22, 2009
February 15, 2009
There are several reasons you may want to keep the controls on the page hidden until the page has loaded. If the user enters data before all the controls are loaded it may cause an error, or you may just not want the user to see the page rendering. The example below shows how to hide the controls from the user and instead display a loading message.
(more…)
January 28, 2009
|