.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Keypress Event for Input not working

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :ASP.Net
HelloI use code below code to call function "search" but it only works when users click on button. Keypress event for input does not working.Culd any one plesae tell me why? <input type="text" name="q" id="q" onkeypress="if(event.keyCode==13) FillForm();" autocomplete="off" /> <input type="button" value="Go" onclick="FillForm()" />

View Complete Post

More Related Resource Links

Working with datepicker and input controls


Helloe all,

Please I'm developing a hotel reservation system and I have both "check in" and "check out" html "input"controls and I have linked these controls to the Jquery datepicker. Unfortunately, I'm not able to access the value of the controls in asp code behind (using their ids CheckInDate and CheckOutDate respectively).

Previously, I used asp textboxes and I was able to access the IDs in code behind but whenever the page displays and I click in any of the textboxes their respective datepicker don't show.

However, I'm able to access the html input controls in code behind when I add runat="server" but when I do that the datepicker don't show for both control when I click in the input boxes.

Someone help me so that I will be able to make the datepicker show as well as fetching/accessing the value of the input boxes (selected dates) in the code behind...... or how to use asp controls and add onclick functions to call the datepicker.

Thank you.


<script type="text/javascript">
        $(function() {       
        $("#CheckInDate").datepicker({ minDate: 0, maxDate: '+1M' });

Keypress Event in asp.net

Hi All,   Hey, I'm having a text box where the user should not manipulate the data. I've done the coding like this <asp:TextBox ID="TextBox2" runat="server"  OnKeyPress = "return false" OnCut = "return false" OnCopy = "return false" OnPaste = "return false"></asp:TextBox>   This is working perfectly. But the problem is, if i give backspace or delete, the keypress event arise. Why is it so !! Can anyone help !!

Code in an event handler not working when used with system reflection.

Hi, I am presently writing an application that uses an MDI form with a ToolStrip on it. I have the need to build the menu items dynamically using an XML file. The format of the XML file is as follows: <ContextMenu EventHandlerHost="vFrmPDUsetup"> <!-- These styles will be applied to the menu items. Individual menu item styles can be override by defining as an attibute to the specific menu item, see below --> <Style> <MenuStripBackColour>Transparent</MenuStripBackColour> <BackColour></BackColour> <ForeColour>Chartreuse</ForeColour> <BackImage></BackImage> <!-- Must exist in Images folder --> <FontName>Tahoma</FontName> <FontSize>10</FontSize> <FontStyle>Bold</FontStyle> </Style> <!-- Attributes: Key = Resource Key name in resource file Image = image to display before text, image must exist in Images folder BackImage = background image, image must exist in Images folder BackColour = background colour as colour name ForeColour = foreground colour as colour name FontSize = size of font as value Seperator = add a menu seperator OnClick = click event pointing to the event handler method which must be defined as the MenuItem_ + <attibute value> &

TextBox AutoPostBack not working when handling other DHTML event


I have to format a number in a TextBox while it is being typed. Right after the TextBox looses focus, I need to do other processing on server side, including some database queries.

I'm doing the formatting by handling the onkeyup event, client side. But when I add the handler, the onTextChanged event stops firing on the server. I've tried different return values for the handler but unfortunatelly I'm stuck.

To reproduce the problem, here is a sample where the formatting function was replaced by a simple "convert to uppercase" function. You'll see that, contrary to the expected, the Label doesn't get filled when the TextBox looses focus. It does get filled, however, if the user presses the ENTER key.

What can I possibly be doing wrong with such a simple task?


<%@ Page Language="VB" %>

<script language="VB" runat="server">

Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)

'' Adding the event handler like this has the same effect as adding it inline

'txtTextBox.Attributes.Add("onkeyup", "return(upperCase(this));")

End Sub

Protected Sub txtTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

lblTextBox.Text = S

Onchange event for datetime field in javascript is not working?


I want to compare start date and end date when start date is changed. If start date is big, on change event i need to make the end date the same as start date.

So I wrote On change event for start date. But it doesnot work  

getField('input','Start Time').onchange = function() {showEndDate()};


function showEndDate()



var date1 = getField('input','Start Time');

var date2 = getField('input','End Time');


but its not firing at all. So you guys have any idea or any other way to do for datetime on change event?

Site Pages Library Event Handler not working



I have created an event handler for Site Pages library in SharePoint 2010. In event Handler I have given the list template id (119 - wiki web page library) but the event handler is not working. Do I need to use different list template id for this.?

Button OnClick event not working.


Hi folks,

I am having trouble with two buttons on a page. I dragged them on to the page and then double- clicked each of them in order to create the OnClick events.

I added my code to the events, but when I click the buttons, their respective events aren't being called.

I am very confused!

Any help is appreciated, thanks!

My .aspx code:

<asp:Button ID="Button3" runat="server" Text="Accept" CausesValidation="true" onclick="Button3_Click" />
        <asp:Button ID="Button4" runat="server" Text="Reject" CausesValidation="true" onclick="Button4_Click" />

My Code behind:

protected void Button3_Click(object sender, EventArgs e)
        int id = int.Parse(queryString);

        #region LiveDatabase
        //string connection = ConfigurationManager.ConnectionStrings["LiveDatabase"].ToString();

        #region MySqlDatabase
        string connection = ConfigurationManager.ConnectionStrings["MySqlDatabase"].ToString();

        MySql.Data.MySqlClient.MySqlConnection MyConn = new MySql.Data.MySqlClient.MySqlConnection(connection);

        string query = "UPDATE p

ImageButton Click Event Not Working


I know this question has been asked before. But for some reason I can't find the exact answer I need for my problem. My problem is as follows:

I am creating a web page (The one posted is just an easy example) that creates multiple ImageButtons on one page via a loop.I have tried many other ways (for example, create instance in form_load and pass to the WriteHtml() method) but I can't figure out a way to complete this. In this example I have 10 buttons that need to be able to be clicked.

Thanks in advance,


The code is as follows:

    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

        private void WriteHtml()
            StringWriter sw = new StringWriter();

            using (HtmlTextWriter writer = new HtmlTextWriter(sw))
                for (int i = 0; i < 10; i++)
                    ImageButton imgBtn = new ImageButton();
                    imgBtn.ID = "imgBtn_" + i;
                    imgBtn.ImageUrl = "images.jpg";
                    imgBtn.Attributes.Add("runAt", "server");
                    imgBtn.Click += new ImageClickEventHandler(imgBtn_Click);

textchange event not working from textbox on formview


Hello guys.  I have a formview which in insertmode is required to assign a value to a textbox from another on textchange event.  I can't get it working.

here's formview code (in bold:  event call:

<asp:FormView ID="fvPrecios" runat="server" AllowPaging="True" DataSourceID="OdsPrecios"
        Style="position: relative" CellPadding="4" ForeColor="#333333"
        DataKeyNames="precnume" >
            <table style="position: relative" width="400">
                    <td style="width: 62px; height: 26px">
                        <asp:Label ID="lblEditNombre" runat="server" Text

DropdownMouse event Not Working IE


Dear friends,

<script language="javascript" type="text/javascript">
        function checkListItem(pEvent) 
            document.getElementById("dvDdlValue").style.display = 'block';
            var title = document.getElementById("ddlCheckItem").value;
            document.getElementById("dvDdlValue").innerHTML = title;

Windows Sharepoint Services 3 search not working getting event ids 2424 and 2436.


I can login with the accounts for content and the search service on the local server.

I have the loopback reg fix.

But the crawler will not crawl.

I have deleted all search databases in sql and it I have created one from scratch and setup different accounts for the content and search service.

I downloaded and installed windows sharepoint services 3 with service pack 2 on another server and when I used the same accounts that I had on the non working sharepoint install the search worked.



Windows Sharepoint Services 3 search not working getting event ids 2424 and 2436


This the default install running on Windows 2008 64 bit.

Our content database is located on the d drive and the Sharepoint services 3 install located on the c drive.

We constantly get event ids 2424 and 2436 when the index tries to run. Which is every five minutes.

I have the loopback fix in place.

This was working fine and then it stopped working. When doing a search on sharepoint we were able to pull up some data but not the newest data.

I  deleted the search database and created a new one with a new name.

I also downloaded and installed a new install of sharepoing services 3 and used the same domain accounts for the search service and the content and the index worked when I uploaded something. I was able to do a search.

I tried running a repair on the sharepoint services 3 install and it didn't work.

I hope it is not necessary to re-install everything from scratch.


Not exactly sure why I don't get id 2424 anymore but it is not there.


event ids are listed below

Log Name:      Application
Source:        Windows SharePoint Services 3 Search
Date:          11/16/2010 11:45:02 AM
Event ID:      2436
Task Category: Gathe

KeyPress Event for asp TextBox


Hi. I've Grid in my page.


I have a text box. When I press a key in the textbox, based on the value it should filter the grid. My Boss want to do with the keypress event. For eg, when i press 'a', then the grid shouwld display the value starts with 'a'. When I press 'ab', it should display the value starts with ab.


Please help on this

Code working in XP / 32 bit won't work in Win 7 / 64 bit - "Input string was not in a correct forma


I'm working on a program in VS 2008 / XP 32 bit. So far everything has been working
fine in both XP 32 bit and Win 7 / 64 bit - until I introduced the following piece of

        private void DateFilter()
            // strDate = "MM/dd/yyyy";

            // convert strDate to yyyyMMdd
            strConvYear = strDate.Substring(6, 4);
            strConvMonth = strDate.Substring(0, 2);
            strConvDay = strDate.Substring(3, 2);
            strConvDate = convYear + convMonth + convDay; // yyyyMMdd
            intConvDate = Convert.ToInt32(strConvDate);

            // convert DateTimePicker (dtpSortDates) format yyyy-MM-dd to yyyyMMdd
            intDtpSortDates =

Working with SharePoint document libraries

Document libraries are collections of files that you can share with team members on a Web based on Microsoft Windows SharePoint Services. For example, you can create a library of common documents for a project, and team members can use their Web browsers to find the files, read them, and make comments. Users with Microsoft Office 2003 can check out and edit the files as if they resided on a local or network drive.

By default, your team Web site comes with a built-in document library named Shared Documents, which is listed on the Quick Launch bar as well as on the Documents and Lists page.

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend