|
-
February 2nd, 2005, 07:47 AM
#1
Problem with command button's access key and Textbox Value
Hi all,
I have a page with Textbox (which is set to AutoPostback
property to False) and a command button.
I have a OnBlur event in javascript which will change the
Textbox text value.
I set AccessKey of the command Button to "B".
The problem is when i click the Textbox and then press
Alt+B, in my command_click event i am unable to access
the changed value (by javascript) but the value before
that.
Can anyone help me in getting out of this problem?
Advance thank you for all the replies...
Bye
Regards
S.Raja Sekaran
-
February 3rd, 2005, 02:28 PM
#2
Re: Problem with command button's access key and Textbox Value
You could duplicate the onblur event code in the command button's onclick event (or wrap it in a function and call it both places). I have tested this and it seems to work as you need it.
Last edited by cmiskow; February 4th, 2005 at 10:16 AM.
-
February 4th, 2005, 01:45 AM
#3
Re: Problem with command button's access key and Textbox Value
Hi cmiskow,
Thanks for your reply.
Can you explain me in brief?
-
February 4th, 2005, 10:25 AM
#4
Re: Problem with command button's access key and Textbox Value
Take whatever javascript you have for the onblur event and wrap it in a javascript function, like this:
Code:
function ChangeText(textBoxID)
{
var textBox = document.getElementById(textBoxID);
// perform text changing operations on value of textBox
}
and call it from the onblur event of the textbox:
TextBox1.Attributes.Add("onblur", "ChangeText('" & TextBox1.ClientID & "');")
Now, also add it to the onclick event of the submit button:
Button1.Attributes.Add("onclick", "ChangeText('" & TextBox1.ClientID & "');")
When you press alt+B, it does not blur the textbox before submitting the form. However, it does trigger the onclick event for the button, so adding the code in both places should take care of it.
-
February 7th, 2005, 01:00 AM
#5
Re: Problem with command button's access key and Textbox Value
Thanks a lot cmiskow,
It works well for me...
Bye
Regards
S.Raja Sekaran
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|