473,387 Members | 1,516 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,387 software developers and data experts.

User Interface Question

I have a webform ( ASP.NET 1.1, CodeBehinde = C#). The user selects an
address item from a dropdown list box. The details of the address then
populate appropriate text boxes. Each textbox has an OnTextChange(), which
serves several (necessary) purposes. One of these is that if there is a
change in the textbox entry, a button 'Save Address' appears.

When the user makes changes to only one textbox, the 'Save Address' button
appears after the postback, and that is usually sufficient for my users to
realize they have to click the button to actually save the changes. My
problems is when the user makes changes to two or more entries. After they
make the first change, and tab to the next field, the 'Save Address' button
appears, as it should. Most users then make the additional changes and
then, without explicitly exiting the last field, click on the 'Save Address'
button. Of course, this click serves only to invoke the OnTextChange()
method of the last textbox, it doesn't actually invoke the OnClick() event
of the 'Save Address' button. The result is that the data doesn't get saved
and my users are confused ( which means they call me, which is my real
problem here).

Is there a common workaround?

Thanks

Phil
Jan 11 '06 #1
5 1474
Use client-side JavaScript to make the button appear or disappear. This can
be done with a CSS style to make the server-side button invisible on the
client (use the CSS "visibility: hidden" style). The button will still be
there, but will be invisible (and therefore not able to be clicked). Use the
"onchange" client-side event of the text box to cause the button's style to
revert to "visibility: visible" without causing a PostBack. Then when the
"Save Address" button is clicked, the server-side "OnClick" event should
always fire for the button.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Phillip N Rounds" <pr*****@cassandragroup.com> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
I have a webform ( ASP.NET 1.1, CodeBehinde = C#). The user selects an
address item from a dropdown list box. The details of the address then
populate appropriate text boxes. Each textbox has an OnTextChange(), which
serves several (necessary) purposes. One of these is that if there is a
change in the textbox entry, a button 'Save Address' appears.

When the user makes changes to only one textbox, the 'Save Address' button
appears after the postback, and that is usually sufficient for my users to
realize they have to click the button to actually save the changes. My
problems is when the user makes changes to two or more entries. After
they make the first change, and tab to the next field, the 'Save Address'
button appears, as it should. Most users then make the additional changes
and then, without explicitly exiting the last field, click on the 'Save
Address' button. Of course, this click serves only to invoke the
OnTextChange() method of the last textbox, it doesn't actually invoke the
OnClick() event of the 'Save Address' button. The result is that the data
doesn't get saved and my users are confused ( which means they call me,
which is my real problem here).

Is there a common workaround?

Thanks

Phil

Jan 12 '06 #2
I would use client side javascript to gray out the button instead of
hiding it...that way users are aware that it is there (but they can't
click it yet)...

document.all["myButtonId"].disabled = true;

....and once you have all data...

document.all["myButtonId"].disabled = false;

You could also hide and show it with...

document.all["myButtonId"].style.display = 'none';

and

document.all["myButtonId"].style.display = 'inline';

I know that the " document.all["ControlId"].property " syntax works
with both IE and Firefox....but...I am kind of new to this javascript
stuff. So, if any of you seasoned veterans have any comments on how I
am doing it...please let us know.

Jan 12 '06 #3
Thanks for the responses.
I was trying to avoid client-side JavaScript for three reasons:
1: I just hate mixing Server Side & Client Side programming
2: Some of the OnTextChange() functions are intrinsically server side
issues, and
3: I don't know how to invoke both client-side and server-side actions
for a single event ( the textchange event )
I know you guys can't help me with 1 & 2, but maybe someone can point me to
the solution to #3

Thanks again for the responses, and in advance for the answer to #3

Phil

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Use client-side JavaScript to make the button appear or disappear. This
can be done with a CSS style to make the server-side button invisible on
the client (use the CSS "visibility: hidden" style). The button will still
be there, but will be invisible (and therefore not able to be clicked).
Use the "onchange" client-side event of the text box to cause the button's
style to revert to "visibility: visible" without causing a PostBack. Then
when the "Save Address" button is clicked, the server-side "OnClick" event
should always fire for the button.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Phillip N Rounds" <pr*****@cassandragroup.com> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
I have a webform ( ASP.NET 1.1, CodeBehinde = C#). The user selects an
address item from a dropdown list box. The details of the address then
populate appropriate text boxes. Each textbox has an OnTextChange(),
which serves several (necessary) purposes. One of these is that if there
is a change in the textbox entry, a button 'Save Address' appears.

When the user makes changes to only one textbox, the 'Save Address'
button appears after the postback, and that is usually sufficient for my
users to realize they have to click the button to actually save the
changes. My problems is when the user makes changes to two or more
entries. After they make the first change, and tab to the next field,
the 'Save Address' button appears, as it should. Most users then make
the additional changes and then, without explicitly exiting the last
field, click on the 'Save Address' button. Of course, this click serves
only to invoke the OnTextChange() method of the last textbox, it doesn't
actually invoke the OnClick() event of the 'Save Address' button. The
result is that the data doesn't get saved and my users are confused (
which means they call me, which is my real problem here).

Is there a common workaround?

Thanks

Phil


Jan 12 '06 #4
Hi Phil,
1: I just hate mixing Server Side & Client Side programming
Well, you must hate ASP.Net, because that's how client-side events are
handled on the server!

When you create an event handler in ASP.Net, JavaScript is added to the
rendered HTML, which adds several hidden form fields, and some JavaScript
that populates these form fields when a client-side event occurs, and then
posts the form back to the server. Take a look at the HTML in your ASP.Net
Pages when viewed in a browser to confirm this.

The only difference in this case is that you don't want to post back to the
server, but handle the client-side "onchange" event on the client only.
2: Some of the OnTextChange() functions are intrinsically server side
issues, and
I don't understand what you mean by this.
3: I don't know how to invoke both client-side and server-side actions
for a single event ( the textchange event )
You don't. You will notice that when you assign a server-side handler for
the TextChange event, client-side JavaScript is added to handle the
client-side "onblur" event. This means that when the focus exits the text
box, a JavaScript event handler is called that sets a hidden form field, and
posts the form back to the server.

Instead, you initially set the button's CSS "visibility" style to "hidden",
handle the "onchange" event of the text box, and set the button's CSS
"visibility" style to "visible". This does not cause a PostBack, which is
not necessary until the user wants to submit the form.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Phillip N Rounds" <pr*****@cassandragroup.com> wrote in message
news:uh**************@TK2MSFTNGP09.phx.gbl... Thanks for the responses.
I was trying to avoid client-side JavaScript for three reasons:
1: I just hate mixing Server Side & Client Side programming
2: Some of the OnTextChange() functions are intrinsically server side
issues, and
3: I don't know how to invoke both client-side and server-side actions
for a single event ( the textchange event )
I know you guys can't help me with 1 & 2, but maybe someone can point me
to the solution to #3

Thanks again for the responses, and in advance for the answer to #3

Phil

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eO**************@TK2MSFTNGP10.phx.gbl...
Use client-side JavaScript to make the button appear or disappear. This
can be done with a CSS style to make the server-side button invisible on
the client (use the CSS "visibility: hidden" style). The button will
still be there, but will be invisible (and therefore not able to be
clicked). Use the "onchange" client-side event of the text box to cause
the button's style to revert to "visibility: visible" without causing a
PostBack. Then when the "Save Address" button is clicked, the server-side
"OnClick" event should always fire for the button.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Phillip N Rounds" <pr*****@cassandragroup.com> wrote in message
news:O3**************@TK2MSFTNGP09.phx.gbl...
I have a webform ( ASP.NET 1.1, CodeBehinde = C#). The user selects an
address item from a dropdown list box. The details of the address then
populate appropriate text boxes. Each textbox has an OnTextChange(),
which serves several (necessary) purposes. One of these is that if
there is a change in the textbox entry, a button 'Save Address' appears.

When the user makes changes to only one textbox, the 'Save Address'
button appears after the postback, and that is usually sufficient for my
users to realize they have to click the button to actually save the
changes. My problems is when the user makes changes to two or more
entries. After they make the first change, and tab to the next field,
the 'Save Address' button appears, as it should. Most users then make
the additional changes and then, without explicitly exiting the last
field, click on the 'Save Address' button. Of course, this click serves
only to invoke the OnTextChange() method of the last textbox, it doesn't
actually invoke the OnClick() event of the 'Save Address' button. The
result is that the data doesn't get saved and my users are confused (
which means they call me, which is my real problem here).

Is there a common workaround?

Thanks

Phil



Jan 12 '06 #5
You can add all of your javascript from the code-behind if you want.

examples...

this.Page.RegisterStartupScript("CheckText","<scri pt
language='javascript'>function CheckText() { ...do something...
}</script>");

this.txtMyTextBox.Attributes.Add("onchange","javas cript:CheckText()");

Jan 12 '06 #6

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

Similar topics

8
by: Eric Veltman | last post by:
Hello everyone, I've posted this question before, but got no answer, so I'll try to reformulate the question, maybe it helps :-) By the way, this is not intended as the start of an ASP.NET...
4
by: nsr93 | last post by:
I am not sure if this was the proper group to post this, but here is my question: I am a Java consultant. I have new client I am working for to make a web based application similar to an...
6
by: Programmer | last post by:
I am making a project in which i have one interface ITest, and a class which is implementing that interface. I am making object of that class using object...
3
by: zlst | last post by:
Many technological innovations rely upon User Interface Design to elevate their technical complexity to a usable product. Technology alone may not win user acceptance and subsequent marketability....
2
by: Dan | last post by:
All, I have a windows form application. The form will host various user controls that will implement an interface so that was new controls can be added later without recompiling the hosting...
3
by: Dan Nash | last post by:
Hi I'm new to C#, moving from ASP, and slightly confused so bear with me! Basically I've got 4 pages, each of which runs the same user control (some header information). I want to be able to...
1
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
1
by: David Hearn | last post by:
I am creating a user control for use on several of my pages. I have some variables that are set on my pages where the user control will be used. I need my user control to automatically be able to...
8
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem...
0
by: MK | last post by:
My web application has a set of steps to accomplish a task. There could be many such tasks. I would like the user interface to be dynamically controlled from a configuration so I can add new input...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.