checkboxlist selected item

Discussion in 'ASP .Net' started by Alex D., Feb 3, 2006.

  1. Alex D.

    Alex D. Guest

    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.
    Alex D., Feb 3, 2006
    #1
    1. Advertising

  2. 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." <> wrote in message
    news:%23mhU%...
    > 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.
    >
    Ken Cox - Microsoft MVP, Feb 4, 2006
    #2
    1. Advertising

  3. That worked just beatifully. Thanks!

    "Ken Cox - Microsoft MVP" <> wrote in message
    news:Ogv%23n$...
    > 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." <> wrote in message
    > news:%23mhU%...
    >> 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.
    >>

    >
    >
    Alejandro Penate-Diaz, Feb 4, 2006
    #3
  4. Thanks for letting us know!

    "Alejandro Penate-Diaz" <> wrote in message
    news:...
    > That worked just beatifully. Thanks!
    >
    > "Ken Cox - Microsoft MVP" <> wrote in message
    > news:Ogv%23n$...
    >> 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." <> wrote in message
    >> news:%23mhU%...
    >>> 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.
    >>>

    >>
    >>

    >
    >
    Ken Cox - Microsoft MVP, Feb 5, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JD
    Replies:
    5
    Views:
    11,619
    NetArchitect
    Aug 8, 2007
  2. Patrick.O.Ige
    Replies:
    5
    Views:
    19,074
    Patrick.O.Ige
    Jun 19, 2005
  3. Iain
    Replies:
    3
    Views:
    916
  4. yh
    Replies:
    1
    Views:
    608
    bruce barker
    Nov 20, 2008
  5. mldardy
    Replies:
    0
    Views:
    950
    mldardy
    Sep 28, 2010
Loading...

Share This Page