473,653 Members | 3,000 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datalist referencing a textbox with javascript

Hi All,

I have a datalist that repeats a list of products and has a textbox called
txtQty which you can change. I would like to put a plus and minus image next
to this textbox that when you click it increments the relevant textbox
accordingly. The problem is obviously that the control txtQty gets named by
the datalist control as it renders it. How can I make sure that clicking the
plus/minus image changes the correct txtQty box.

Thanks in advance

Neil
Oct 25 '07 #1
1 1389
I would play with the event OnItemDataBound and the ClientID of the current
button:

http://msdn2.microsoft.com/en-us/lib...databound.aspx

Good luck
Braulio
/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------


"Neil Steventon" wrote:
Hi All,

I have a datalist that repeats a list of products and has a textbox called
txtQty which you can change. I would like to put a plus and minus image next
to this textbox that when you click it increments the relevant textbox
accordingly. The problem is obviously that the control txtQty gets named by
the datalist control as it renders it. How can I make sure that clicking the
plus/minus image changes the correct txtQty box.

Thanks in advance

Neil
Oct 25 '07 #2

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

Similar topics

1
2393
by: Hrvoje Vrbanc | last post by:
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...
8
653
by: MattB | last post by:
I think I'm close to making this work, but so far it does not. I have a datalist (id = "dlVFields") on a web form that has an item template with a textbox in it. The textbox id = "txtVerify". When the form is submitted via a button click (button is outside datalist) I loop through the datalist's DataListItem collection to retrieve any values entered into the textboxes. My problem is that I'm not getting anything back from the textboxes...
0
1716
by: Renato Neves | last post by:
My problem is simple, i have a datalist control with some controls inside of EditTemplate (the problem is the same in the DataGrid). I want to have access to this controls, using javascript, but i can't. How can i do this? <Code> <script language="javascript"> document.getElementById('<%=txt1.ClientID %>').value='test'; document.getElementById('<%=txt2.ClientID %>').value='test';
10
2844
by: Bharat | last post by:
Hi Folks, Suppose I have two link button on a page (say lnkBtn1 and lnkBtn2). On the click event of the lnkbtn1 I have to add a dynamically created control. And On the click event of the lnkBtn2 I have to add a datalist control. Using this datalist control I should be able to add edit, modify and cancel the items listed in this control. Here is how I designed. I used placeholder to add the controls dynamically to the page on the click...
0
912
by: Patrick.O.Ige | last post by:
I have a href link in a Datalist <a href="addtocart.aspx" onmouseover="void validateNumericField(document.Form1.txtphone);" onkeyup="jump();" > I'm trying to validate a TextBox with Id ="txtphone" as above The TextBox is also in a Datalist. I have declared the textbox in the OnItemDataBound of the DataList like so:- Dim txt As TextBox = CType(e.Item.FindControl("txtphone"), TextBox)
4
2783
by: Jerry Camel | last post by:
Once the datalist is in edit mode and the text boxes and all happily appear, how can I force the textbox to be the control with focus, so the user can start editing without having to click the textbox first? Thanks. Jerry
3
10292
by: Mirek Endys | last post by:
I have DataList as part of DataList item. DataList in DataList. The parent DataList working well including Edit command, that shows Edit template and correctly bind the data into edit template (where is the child DataList).... But in case I want to make Edit in this child DataList it is not working... No edit template showed... :( this is a code that i use for the child DataList... Edit command // this is for child DataList...
1
1970
by: WB | last post by:
Hi, I would like to do something like this page: http://www.stocklayouts.com/Products/Postcard/Postcard-Template-Design-Library.aspx?kwid=38 Notice when you mouse-over any of the icons under each thumbnail, a little description will appear to tell you what the icon is for. Okay, so I have a DataList in a stucture like this: <asp:DataList ID="DlsBrochures" runat="server" RepeatDirection="Horizontal">
3
2804
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I need to control the visibility of a textbox based on a dropdown selection in the datalist's edititem template. To do this, I registered a client script block function and attached a client side handler for the dropdownlist's onchange event in the...
0
8811
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8704
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 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...
0
8590
tracyyun
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...
0
7302
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5620
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();...
0
4147
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.