473,382 Members | 1,258 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

values lost on postback when using ENTER key, help

Using C# and JavaScript Framework 2.0

My users want to be able to start a search by clicking the enter key. Since
the page uses View control, I placed an onkeypress event on the table for
each view to check for keyCode 13. If it detects the enter key, then it calls
a JS function that does some validation and then calls the button click that
should have been fired for the active view. For example:

document.getElementById("ctl03_btnSmartSearch").cl ick()

Everything works great. Both my OnClientClick and OnClick attributes for the
button appear to fire. On the postback though, all my values are gone. I cant
even Request them. But if I physically click the same button with the mouse,
all my values are there. Is there a view state or something I missing that
needs to occur when I call the click via JS verses using the mouse to click
the button?
help
--
JP
..NET Software Developer
Apr 6 '07 #1
1 1348

JP wrote:
Using C# and JavaScript Framework 2.0

My users want to be able to start a search by clicking the enter key. Since
the page uses View control, I placed an onkeypress event on the table for
each view to check for keyCode 13. If it detects the enter key, then it calls
a JS function that does some validation and then calls the button click that
should have been fired for the active view. For example:

document.getElementById("ctl03_btnSmartSearch").cl ick()

Everything works great. Both my OnClientClick and OnClick attributes for the
button appear to fire. On the postback though, all my values are gone. I cant
even Request them. But if I physically click the same button with the mouse,
all my values are there. Is there a view state or something I missing that
needs to occur when I call the click via JS verses using the mouse to click
the button?
help
--
JP
.NET Software Developer

If I understand it correctly it occurs when user types a search
keyword and then presses Enter?
It can happens because onchange event occurs only after you leave the
input field. As a variant you can try to focus the btnSmartSearch
button.
Example:
document.getElementById("ctl03_btnSmartSearch").fo cus();
document.getElementById("ctl03_btnSmartSearch").cl ick();

Apr 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ron Wallegie | last post by:
I developed a webesite using c#. I have a dropdownlist wich is filled with database values. When i click on a button on the same page all values are lost in the dropdownlist. The most common...
3
by: Rajesh | last post by:
Hello all, I have a problem here. I have a procedure called FillForm() where I populate values for some hidden asp:textboxes. But after I do a postback, my values in the textboxes are lost and I...
2
by: Ashish | last post by:
Hi All, I have a server runnable textbox control. I also have a server side button object but I hook up javascript to it to show a modal dialog. Upon return it places the value in the textbox...
6
by: Neil | last post by:
Hi, I have an aspx page with a number of web controls on it and one of these is a cancel button. I want to check the page to see if the user has changed any of the controls, i..e typed some text...
2
by: Alan Lambert | last post by:
I have a web page that contains, amongst other things, a DropDownList called drpProjectCodes) and a Panel (called pnlStatus) which contains six Checkboxes. drpProjectCodes contains a list of...
6
by: Janaka | last post by:
Help! I have two ListBox controls on my web form. The first one gets populated on entry with values from the DB. I then use JavaScript to copy options from this ListBox to my second one. (I...
3
by: Pipo | last post by:
Hi, I'm trying to make my own web custom control. I've made a control with 2 textboxes and 1 dropdownlist. But when I enter values in them and get a postback the values are gone. How can I hold...
4
by: Frank | last post by:
Hello everyone, I have a problem that the window.opener variable is lost once my popup page has a postback. On multiple pages they address this problem but I cannot find a correct answer. ...
5
by: Nathan Sokalski | last post by:
I have a custom control that I wrote (I inherit from System.Web.UI.WebControls.CompositeControl). I dynamically add this control to my Page, but I was told that dynamically added controls do not...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.