473,396 Members | 2,070 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,396 software developers and data experts.

Button.Attributes.Add refreshing problem

I have a popup window, which consists of a TextBox(txtConnectionString) and a
Button(btnOK). And, I would to pass the TextBox.Text to a javascript
function, when Button is clicked. I write the following code in order to do
such thing:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.btnOK.Attributes.Add("onclick", "Done('" &
txtConnectionString.Text & "');")
End Sub

Whereas, after I open the window and change the TextBox.Text, it will pass
the old textbox value to the javascript function, but not the new value. Why
this happen and how to solve?

Please help...thanks.
Nov 19 '05 #1
2 1236
the reason is cause you are hardcoding this value on page load.

So once you change the textbox, you still have that value hardcoded
"txtConnectionString.Text"

Try getting your JavaScript code to read the text value instead of passing
it from the onclick method as your server will not no how the value has
changed client side.

so in you page load:
Me.btnOK.Attributes.Add("onclick", "SomeJavaScriptMethod();")

In Your JavaScript
function SomJavaScriptMethod()
{
alert(document.getElementById("txtConnectionString ").value);
}

HTH

"Chrysan" <Ch*****@discussions.microsoft.com> wrote in message
news:A4**********************************@microsof t.com...
I have a popup window, which consists of a TextBox(txtConnectionString) and
a
Button(btnOK). And, I would to pass the TextBox.Text to a javascript
function, when Button is clicked. I write the following code in order to
do
such thing:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.btnOK.Attributes.Add("onclick", "Done('" &
txtConnectionString.Text & "');")
End Sub

Whereas, after I open the window and change the TextBox.Text, it will pass
the old textbox value to the javascript function, but not the new value.
Why
this happen and how to solve?

Please help...thanks.

Nov 19 '05 #2
Thanks a lot....it works.

Nov 19 '05 #3

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

Similar topics

14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
7
by: IntraRELY | last post by:
I am using the following command to launch and .NET VB Executable, which is a simple Windows Form (printCheckClient.exe). I am using a HyperLink Control and works perfect....
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
5
by: dkao99 | last post by:
I encounter a problem with refreshing when I click the sort button icon on a form that has 15,500 records with 25 columns initially. There is no problem scroll/page down/up on initial form but after...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.