473,796 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

emit client script in check box list

h

How do i get an asp checkBoxList to emit client script. I want it so that when each checkbox is clicked, i can cause some action to happen

i tried

CheckBoxList cbl = new CheckBoxList()
for(int i = 0; i < 5; i++

ListItem li = new ListItem(i.ToSt ring(), i.ToString())
li.Attributes.A dd("onclick", string.Format(" alert('{0}')", i.ToString()))
cbl.Items.Add(l i)
but no onclick attribute is emitted to the page
Am i doing it wrong, or is there a way around this

Ada

Nov 18 '05 #1
1 1479
The checkbox list translates to a table where every checkbox is an <input
.... type="checkbox ...>. The inputs have id made out of the checkbox list id
with suffix _0, _1 etc. You can make a client script that will locate the
<input...> elements and set them up for the actions you need.

Eliyahu

"ad**@twv.o rg" <an*******@disc ussions.microso ft.com> wrote in message
news:84******** *************** ***********@mic rosoft.com...
hi

How do i get an asp checkBoxList to emit client script. I want it so that when each checkbox is clicked, i can cause some action to happen.
i tried:

CheckBoxList cbl = new CheckBoxList();
for(int i = 0; i < 5; i++)
{
ListItem li = new ListItem(i.ToSt ring(), i.ToString());
li.Attributes.A dd("onclick", string.Format(" alert('{0}')", i.ToString())); cbl.Items.Add(l i);
}

but no onclick attribute is emitted to the page.
Am i doing it wrong, or is there a way around this?

Adam

Nov 18 '05 #2

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

Similar topics

1
1708
by: Ken Fine | last post by:
I need a client-side check against a static list of "banned words" before a form is submitted. Can someone point me to a script that does this?
8
2549
by: Eyeawanda Pondicherry | last post by:
I have put some code together that creates an enum dynamically from some database values. The enum can be read perfectly by an application that references the dynamically generated dll. If I /emit/ a new version of the assembly, and start the application again, the new values will appear for the enum. However, suppose I want the application to remain in a running state.
2
3639
by: Luis Arvayo | last post by:
Hi, In c#, I need to dynamically create types at runtime that will consist of the following: - inherits from a given interface - will have a constructor with an int argument
0
1666
by: =?Utf-8?B?QXJ0dXJvIE1hcnRpbmV6?= | last post by:
I've been looking everywhere on how to call AddRange Method of a List<myClassfield in Reflection.Emit My code goes like this MethodInfo method = typeof(List<>).MakeGenericType(typeof(myClass)).GetMethod("AddRange", BindingFlags.Instance | BindingFlags.Public, null, new Type { typeof(IEnumerable<>).MakeGenericType(typeof(myClass)) }, null)); and then the implementation
0
9679
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9527
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
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
10223
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
9050
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...
1
7546
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
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
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
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 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.