I'm not sure how to exactly ask this, but expect that it's a Javascript
solution. However, I'll ask the question and maybe someone can point
me to some existing code that will do what I need.
I have an Asp.Net app that's in 2.0 framework. I have a page that is
sort of a storefront sort of page that has a product, a quantity and a
button for "Add To Cart" and one for "Add To Wishlist".
I'd like to disable those two buttons if the quantity is not greater
than zero.
Can someone help? 13 3832
Hi,
HockeyFan wrote:
I'm not sure how to exactly ask this, but expect that it's a Javascript
solution. However, I'll ask the question and maybe someone can point
me to some existing code that will do what I need.
I have an Asp.Net app that's in 2.0 framework. I have a page that is
sort of a storefront sort of page that has a product, a quantity and a
button for "Add To Cart" and one for "Add To Wishlist".
I'd like to disable those two buttons if the quantity is not greater
than zero.
use compare-validators for things like this - these will validate data on
the client-side. Set your button's CausesValidatio n-property to True, add a
compare-validator for each textbox, linking them to another. If you need
several different validation-groups, use the ValidationGroup-properties. If
you'd rather like to display a single message (as opposed to or in addition
to showing error-messages right next to the control), use a
ValidationSumma ry-control.
Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
Off the top of my head without seeing your code: I suppose you could
default the buttons to be disabled and fire the "TextChange d" event
when a value is entered in a quantity textbox or the
"SelectedIndexC hanged" event if it is a drop down list. In these
events, you can then enable the buttons. You will probably need to put
code in the events to check if your qty is greater than 0 or not and
enable/disable accordingly (the user may remove items from cart as well
as add?).
HockeyFan wrote:
I'm not sure how to exactly ask this, but expect that it's a Javascript
solution. However, I'll ask the question and maybe someone can point
me to some existing code that will do what I need.
I have an Asp.Net app that's in 2.0 framework. I have a page that is
sort of a storefront sort of page that has a product, a quantity and a
button for "Add To Cart" and one for "Add To Wishlist".
I'd like to disable those two buttons if the quantity is not greater
than zero.
Can someone help?
HockeyFan wrote:
I'm not sure how to exactly ask this, but expect that it's a Javascript
solution. However, I'll ask the question and maybe someone can point
me to some existing code that will do what I need.
I have an Asp.Net app that's in 2.0 framework. I have a page that is
sort of a storefront sort of page that has a product, a quantity and a
button for "Add To Cart" and one for "Add To Wishlist".
I'd like to disable those two buttons if the quantity is not greater
than zero.
Can someone help?
Olaf's advice looks good. Validators are ideal for situations like
this.
I believe they want to enable/disable buttons and not display messages
when the qty is 0. Please advise on how to do this with validators.
Eric wrote:
HockeyFan wrote:
I'm not sure how to exactly ask this, but expect that it's a Javascript
solution. However, I'll ask the question and maybe someone can point
me to some existing code that will do what I need.
I have an Asp.Net app that's in 2.0 framework. I have a page that is
sort of a storefront sort of page that has a product, a quantity and a
button for "Add To Cart" and one for "Add To Wishlist".
I'd like to disable those two buttons if the quantity is not greater
than zero.
Can someone help?
Olaf's advice looks good. Validators are ideal for situations like
this.
"Eric" <ve****@gmail.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.com.. .
Olaf's advice looks good. Validators are ideal for situations like
this.
I disagree - I think bpd has the right idea...
Hi,
Mark Rae wrote:
>Olaf's advice looks good. Validators are ideal for situations like this.
I disagree - I think bpd has the right idea...
thing is, you'd need server-side code in order to actually enable the
button. If there's a client-side-way of dealing with this (i.e. enabling a
control), then I'd sure like to know ...
Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
"Olaf Rabbachin" <Ol*********@In tuiDev.comwrote in message
news:eA******** ******@TK2MSFTN GP04.phx.gbl...
thing is, you'd need server-side code in order to actually enable the
button. If there's a client-side-way of dealing with this (i.e. enabling a
control), then I'd sure like to know ...
??? You can enable / disable a control with client-side JavaScript just as
easily as you can with server-side C#.
<script type="text/javascript">
function enableButtons
{
document.getEle mentById('MyBut ton').disabled =
(parseInt(docum ent.getElementB yId('MyTextBox' ).value) == 0);
}
</script>
<input type="text" id="MyTextBox" onblur="enableB uttons();" />
<input type="button" id="MyButton" value="Save" />
Hi,
Mark Rae wrote:
??? You can enable / disable a control with client-side JavaScript just as
easily as you can with server-side C#.
<script ...
great, thanks! I simply have lots to learn concerning JS. :-)
Since we're at this - assuming the following script-code ...
If Not ClientScript.Is ClientScriptBlo ckRegistered("E nableGo") Then
Dim strJS As String = _
"<script language=""Java Script""" & _
"function enableGo(chk) {" & _
"document.getEl ementById(""" & cmdGo.ClientID & """).disabl ed = " & _
"(document.getE lementById(chk) .checked == false);" & _
"}" & _
"</script>"
ClientScript.Re gisterClientScr iptBlock(Me.Get Type, "EnableGo", strJS)
End If
.... which is supposed to enable a button if the passed checkbox's ID
(ClientID) is checked. With controls that have been created at design-time,
this will work just fine (as with cmdGo.ClientID) , but in my case the
checkboxes are created dynamically.
Hence, I'm doing the following for each checkbox being created:
dim chkBox as New CheckBox
....
chkBox.Attribut es.Add("onclick ", "enableGo(" & chkBox.ClientID & ")")
However, instead of the ClientID, only the ID will be passed and the script
fails. Any clue on how to get this working for dynamic controls?
Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
"Olaf Rabbachin" <Ol*********@In tuiDev.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Mark Rae wrote:
>??? You can enable / disable a control with client-side JavaScript just as easily as you can with server-side C#.
<script ...
great, thanks! I simply have lots to learn concerning JS. :-)
JavaScript remains as important in web development now as when it first
appeared - ASP.NET hasn't changed that at all...
"<script language=""Java Script""" & _
"<script language=""text/javascript""" & _
if you want it to be XHTML-compliant...
However, instead of the ClientID, only the ID will be passed and the
script
fails. Any clue on how to get this working for dynamic controls?
I assume you're creating the dynamic controls in Page_Init - if not, you
need to... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeff Nibler |
last post by:
I'm trying to set the width of a textbox via a style sheet but it isn't working for Netscape 4.7
This is what the page looks like:
<form>
<input type="text" class="t1">
</form>
This is what the style sheet looks like:
|
by: Ramsin Savra |
last post by:
Hi,
What do you suggest to do if I want to do a search in TextBox ? I know that
using RichTextBox, we could have Find method to search for a specific word
or information but I was wonder if somebody knows some methods for Find and
Replace in TextBox.
Thanks
|
by: Drew Berkemeyer |
last post by:
I've encounted a pretty strange problem and I'm not quite sure what to make
of it.
I have a web service that consumes an XML file as well as a few other
parameters. This web service works fine if I use the web test interface. It
also works fine if I call it from an ASP.NET page that has a text box where
the XML is pasted and then passed on. However, I get an exception if I use
an <input type="file"> control on the ASP page that allows...
|
by: BobRoyAce |
last post by:
Let's say I have a text box on a page in which a user is to enter a monetary
amount and that I want to ensure that the user enters a value greater than
or equal to a certain value that will be determined by interrogating a
database at runtime. There is a button on the page that the user clicks on
to Save the data they have entered. In the click event of this button I want
to check to see if they have entered a value no greater than the...
|
by: hemant |
last post by:
hello everybody,
I am having a datagrid which has data regarding customers. it has a
penalty column, and i want to show the entire record of the customer
in red whose penalty is greater than zero.
i have looked into the other messages which guide to override the
paint procedure of the datagrid, make a new class etc.
i am not able to understand the exact way of doing the mentioned
| |
by: MLH |
last post by:
I use A97. I've gotten used to reading values from textbox controls
on forms, I've come to rely on it pretty heavily. My habit spills over
into reports. I'm uncertain whether I can reliably read the values
in textbox controls on reports during the OnFormat event code
the same way I've been doing so in forms.
I have a report I call the 402 report and on it is a LaborCost
textbox. I use a line of code something like this
If txtLaborCost...
|
by: simon |
last post by:
hello,
new to vb.net, have a few questions about DataGrid. I have a dataGrid
that is working pulling a dataset back from a stored proc and binding
to the datagrid for display
the datagrid's first column is a textbox(TemplateColumn), the other 3
columns are just display(BoundColumn).
(1) if the value of the textbox is 0, then i'd like to change it null,
so the box is empty
|
by: Luqman |
last post by:
I have coded in Textbox_changed Event:
If CType(txtVoucherNo.Text, Long) = 0 Then
Me.DetailsView1.ChangeMode(DetailsViewMode.Insert)
Me.DetailsView1.AutoGenerateInsertButton = True
Me.DetailsView1.AutoGenerateEditButton = True
|
by: =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?= |
last post by:
I'm sorry, but I've read your code a couple of times and just don't see where
the Form1 is initialized. Form1 also sounds like a class name, and this
would be how you could do some form operations in vb6, but not in .Net. This
would explain why the messagebox works, as it is not instantiated, but called
statically as you did in your code.
I think you need this where your MsgBox is called:
dim ui as New Form1()
ui.txt_rec.Text =...
|
by: Astley Le Jasper |
last post by:
Sorry for the numpty question ...
How do you find the reference name of an object?
So if i have this
bob = modulename.objectname()
how do i find that the name is 'bob'
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |