473,405 Members | 2,294 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,405 software developers and data experts.

checkboxlist selected item

does any body knows how to get the checkbox clicked in a checkboxlist using
the SelectedIndexChanged event? The "EventArgs" dont help too much..
thanks,
Alex.
Feb 3 '06 #1
3 9114
Hi Alex,

That info is contained in ASP.NET's own __EVENTTARGET field. You should be
able to get it from there as shown in the following code.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If IsPostBack Then
Response.Write("Postback by: " & _
Request.Form("__EVENTTARGET") & "<br />")
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Who posted back?</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:checkboxlist id="CheckBoxList1" runat="server"
autopostback="True">
<asp:listitem>Red</asp:listitem>
<asp:listitem>Green</asp:listitem>
<asp:listitem>Blue</asp:listitem>
</asp:checkboxlist></div>
</form>
</body>
</html>

"Alex D." <al********@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
does any body knows how to get the checkbox clicked in a checkboxlist
using the SelectedIndexChanged event? The "EventArgs" dont help too much..
thanks,
Alex.

Feb 4 '06 #2
That worked just beatifully. Thanks!

"Ken Cox - Microsoft MVP" <BA**********@hotmail.com> wrote in message
news:Og****************@TK2MSFTNGP11.phx.gbl...
Hi Alex,

That info is contained in ASP.NET's own __EVENTTARGET field. You should be
able to get it from there as shown in the following code.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If IsPostBack Then
Response.Write("Postback by: " & _
Request.Form("__EVENTTARGET") & "<br />")
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Who posted back?</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:checkboxlist id="CheckBoxList1" runat="server"
autopostback="True">
<asp:listitem>Red</asp:listitem>
<asp:listitem>Green</asp:listitem>
<asp:listitem>Blue</asp:listitem>
</asp:checkboxlist></div>
</form>
</body>
</html>

"Alex D." <al********@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
does any body knows how to get the checkbox clicked in a checkboxlist
using the SelectedIndexChanged event? The "EventArgs" dont help too
much..
thanks,
Alex.


Feb 4 '06 #3
Thanks for letting us know!

"Alejandro Penate-Diaz" <al********@hotmail.com> wrote in message
news:ee**************@tk2msftngp13.phx.gbl...
That worked just beatifully. Thanks!

"Ken Cox - Microsoft MVP" <BA**********@hotmail.com> wrote in message
news:Og****************@TK2MSFTNGP11.phx.gbl...
Hi Alex,

That info is contained in ASP.NET's own __EVENTTARGET field. You should
be able to get it from there as shown in the following code.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
Protected Sub Page_Load _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
If IsPostBack Then
Response.Write("Postback by: " & _
Request.Form("__EVENTTARGET") & "<br />")
End If
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Who posted back?</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:checkboxlist id="CheckBoxList1" runat="server"
autopostback="True">
<asp:listitem>Red</asp:listitem>
<asp:listitem>Green</asp:listitem>
<asp:listitem>Blue</asp:listitem>
</asp:checkboxlist></div>
</form>
</body>
</html>

"Alex D." <al********@hotmail.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
does any body knows how to get the checkbox clicked in a checkboxlist
using the SelectedIndexChanged event? The "EventArgs" dont help too
much..
thanks,
Alex.



Feb 5 '06 #4

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

Similar topics

0
by: Bryce Budd | last post by:
Hello All, I've been a taker of information from newsgroups for a long time and thought I'd finally make a contribution back to the community whose supported me when I've needed it. After all...
4
by: dm_dal | last post by:
Is there a know issue surrounding the CheckBoxList control and it's viewstate? When my control is created, it's ListItems are checked as needed, but on a postback, they loose their Selected...
1
by: Ryan Scully | last post by:
Hello I have problem with determining exactly what CheckBoxList element is selected using JavaScript code. When I databind to the checkboxlist it renders it on the page and instead of giving each...
2
by: Ratman | last post by:
I have the following function that created a checkboxlist and "is supposed" to be checking values that are already saved in the database. As I step thru the code, it is in fact marking the...
3
by: Elad Volpin | last post by:
Can someone please explain this: I created a new webform with a PlaceHolder and a Button. My Page_Load contains the following code: private void Page_Load(object sender, System.EventArgs e)...
5
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able...
4
by: Patrick.O.Ige | last post by:
I have a CheckBoxList in a DataList and i'm trying to get item Selected after doing a postBack. I have set my CheckBoxlist AutoPostBack="True" Any ideas what 'm doing wrong? It seems not to...
2
by: jase_rw | last post by:
Hi There, Having trouble with a CheckBoxList in VB.NET. I've a CheckBoxList on a webform. I read some data from a database and try and check the appropriate boxes based on the data....
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
3
by: onlyprad | last post by:
Hi, I am populating the checkboxlist in (!IsPostBack) block of page load event with some checked items. After populating with checked items I am iterating through the items collection and...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
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...
0
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...
0
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...
0
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,...

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.