We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable Backspace key and Delete key in dropdowncalendar control

Thread ID:

Created:

Updated:

Platform:

Replies:

69441 Oct 27,2007 01:51 PM UTC Nov 19,2007 01:44 PM UTC ASP.NET Web Forms (Classic) 4
loading
Tags: Tools
Peter Zheng
Asked On October 27, 2007 01:51 PM UTC

I have a question: how to disable Backspace key and Delete key when textbox is selected in dropdowncalendar control?

Rajarajeswari S [Syncfusion]
Replied On November 5, 2007 04:41 AM UTC


Hi,

Sorry for the delay in response.

To make the Backspace and Delete keys disable we have to catch the keyboard events. Javascript allows the following events related with keyboard:

onKeyUp
onKeyDown.

But both of these events can only be applied to Text and TextArea and not for Select controls, etc. So your requirement is not possible.

Please let me know if you have any other queries.

Regards,
S.Rajarajeswari


Suresh Sekarean [Syncfusion]
Replied On November 9, 2007 03:02 PM UTC

Hi Peter,

The above requirement can be met by rewriting the existing onkeydown event of DropDownCalendar control Textbox element. And the keys pressed can be validated in this event. Please refer the below code snippet .

[C#]

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//DropDownCalendar control attributes collections should be set before 'RenderChildren' method.
CustomDropDownControl DropDownCalendarControl1 = new CustomDropDownControl();
//Add dropdown control in the PlaceHolder control list
PlaceHolder1.Controls.Add(DropDownCalendarControl1);
}
}
public class CustomDropDownControl : DropDownCalendarControl
{
protected override void RenderChildren(HtmlTextWriter writer)
{
//Insert the Validation script here.
this.m_textBox.Attributes["onkeydown"] = "if(event.keyCode!=8){if(event.keyCode!=46){" + this.m_textBox.Attributes["onkeydown"] + "}else return false;}else return false;";
base.RenderChildren(writer);
}
}

Please refer the below sample which illustrates the above.

http://websamples.syncfusion.com/samples/Tools.Web/5.2.0.25/F69441/main.htm

Please try this and let us know if this helps.

Regards,
Sureshsekaran.



Peter Zheng
Replied On November 15, 2007 03:58 PM UTC

Hi, Sureshsekaran

Thanks. I have another question. I just upgraded Essential Studio to version 5.202.0.25. The dropdowncalendar's CultureSource dose not work any more. My setting is "From Server". Is there a workaround?


Rajarajeswari S [Syncfusion]
Replied On November 19, 2007 01:44 PM UTC



Hi Peter,

CultureSource property specifies the current culture for the control. The values includes,

• FromClient - culture is obtained from the data posted by browser.
• FromServer - culture is obtained from web-server hosting page.
• UserOverride - user defined culture.

Please have a look at the sample browser sample from the below link where the culture source property is used to set different culture.

C:\Documents and Settings\User Name\My Documents\Syncfusion\EssentialStudio\5.2.0.25\Web\tools.web\Samples\2.0\EditorsPackage\EditorsPackage\DataEditorsCultureInformation\cs

And also you can get more information on the culture source property from the following link.

http://www2.syncfusion.com/ug_latest/toolsweb/default.html

Please check with these and if still the problem exists, could you please try
reproducing it in the above sample or send us the reproducing steps so that we could sort
out the cause of the issue and provide you a solution?

Regards,
Raji



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;