473,569 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JavaScript validation of a DataList

Hello all,

I have a DataList control displaying data from the database (some products).
There are also TexBox controls and ImageButton controls in the two columns
of the DataGrid. I would like to implement client-side validation so that
when user clicks ImageButton (with add to basket function), JavaScript
checks if the correct string was entered in the aforementioned TextBox. All
this is usual and the JavaScript in itself is not a problem of course, but
how do I wire those ImageButton controls (in fact their OnClick events) to
JavaScript and how do I pass the value from TextBox control (DataList child
control) to JScript?

Many thanks,
Hrvoje
Nov 17 '05 #1
1 2387
You can use something like 'this.nextSibli ng.value', if the textbox is
rendered right after your button.

"Hrvoje Vrbanc" <hr*****@recro. hr> wrote in message
news:O8******** *******@tk2msft ngp13.phx.gbl.. .
Hello all,

I have a DataList control displaying data from the database (some products). There are also TexBox controls and ImageButton controls in the two columns
of the DataGrid. I would like to implement client-side validation so that
when user clicks ImageButton (with add to basket function), JavaScript
checks if the correct string was entered in the aforementioned TextBox. All this is usual and the JavaScript in itself is not a problem of course, but
how do I wire those ImageButton controls (in fact their OnClick events) to
JavaScript and how do I pass the value from TextBox control (DataList child control) to JScript?

Many thanks,
Hrvoje

Nov 17 '05 #2

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

Similar topics

0
1076
by: rufus | last post by:
I have added some javascript to a button which is built in the MyDataList_ItemCreated event. It produces the following code which works (ie the EnableValidators function fires): <input type="submit" name="btn2" value="Button" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="btn2"...
1
4770
by: Kevin | last post by:
Hi all, I'm now very frustrated, I've been battling all of today to try and understand the datalist, editing, inserting, updating, etc, I have managed to get most of that sort of stuff working(Thank goodness:)). But now I would like to implement validation on my datalist, but I am just not getting it right :(( I have got labels in my item...
1
5309
by: Nevyn Twyll | last post by:
I have a DataList; in the DataList's , I have a LinkButton and a few listboxes. When the LinkButton is pressed, I need to get the ID of the selected item in one of the Listbox controls. Then I want to launch another web page in a seperate window, using that ID. In the header of the web page, I have a javascript function LaunchMyWindow(iID)...
1
1876
by: moondaddy | last post by:
I have a datalist that makes use of the edit template. In this template I also have client side validation controls for required fields. My problem is that when I click on the cancel button it won't do a postback to cancel the update when the form's not valid. How can I bypass the validation for the cancel button? --...
0
1253
by: Chris Fink | last post by:
I have the need to perform some javascript code on a rendered datalist. However, the problem is that the objects that I want to control via javascript have been given unique names when the datalist is rendered, for example, txtInput control in my datalist item template is now called txtInput_ctl59 since .Net has to give each input box a unique...
6
2889
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>' Width="30px" ToolTip='<%# Eval("M1") %>'></asp:TextBox>
0
1278
by: diff | last post by:
I am having trouble preventing a bound source from updating using event-driven validation. There is a very nice article on MSDN explaining this; http://msdn.microsoft.com/en-us/library/ms229603.aspx It clearly states, "When you use data binding, the data in your control is synchronized with the data source during execution of the Validating...
4
3976
by: Peter | last post by:
I have a DataList and each item in the datalist has an imge, I want to change the datalist item image on the client side when user clicks a button. How would I do that with JavaScript, does anyone has an example of how to change a DataList item with JavaScript? Thank You Peter
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7666
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...
0
6278
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
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...
0
5217
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...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.