473,320 Members | 1,987 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,320 software developers and data experts.

Checkboxlist inside Repeater - doesn't fire click event for Checkboxlist

JD
Hello,
I have a problem with checkboxlist inside Repeater (in ASP.NET page).
I am able to create Checkboxlist and bind it (inside Repeater_ItemBound -
including setting checked/unchecked). Checkboxlist has Autopostback=true so
whenever I click on checkbox, the page is submitted to the server.

Here starts my problem:
I am not able to capture the click event of checkbox list to find out which
checkbox was clicked (which generated click event) and retrieve the value
associated with it (for further processing).
I have List_SelectedIndexChanged function but it never fires. I am obviously
missing something, I don't undestand event bubling enough.
Any idea? Any help?
Thanks
JD
Nov 18 '05 #1
3 6663
JD,

I have some sample code in the code library of my web site,
www.aboutfortunate.com, which shows how to get the value of the row clicked
in a datagrid when a check box is checked.

While it doesn't use a repeater or a checkbox list the process is very
similar to what you need to do and quite a bit simpler so it may be good for
you to give it a glance. It may help.

Click the "code library" link on the top right of the home page and then use
the search box to search for: "reference a checkbox" or something similar
and you'll find it.

Pay particular attention to how I'm using "oncheckedchanged" in the check
boxe's auto post back to call the proper subroutine when the checkbox is
clicked.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"JD" <sk*****@hotmail.com> wrote in message
news:uy*************@TK2MSFTNGP09.phx.gbl...
Hello,
I have a problem with checkboxlist inside Repeater (in ASP.NET page).
I am able to create Checkboxlist and bind it (inside Repeater_ItemBound -
including setting checked/unchecked). Checkboxlist has Autopostback=true so whenever I click on checkbox, the page is submitted to the server.

Here starts my problem:
I am not able to capture the click event of checkbox list to find out which checkbox was clicked (which generated click event) and retrieve the value
associated with it (for further processing).
I have List_SelectedIndexChanged function but it never fires. I am obviously missing something, I don't undestand event bubling enough.
Any idea? Any help?
Thanks
JD

Nov 18 '05 #2
have you tried to create the event of the checkboxlist like

<asp:CheckBoxList id=.... OnSelectedIndexChanged="YourEventName"
AutoPostBack=True>
.....

this will tell to the asp.net that when a checkbox is clicked the
YourEventName event will fired, BUT you have to declare your event as Public
other wise asp.net won't find it :(

Hope This Helps
Regards
Martin Marinov

"JD" <sk*****@hotmail.com> wrote in message
news:uy*************@TK2MSFTNGP09.phx.gbl...
Hello,
I have a problem with checkboxlist inside Repeater (in ASP.NET page).
I am able to create Checkboxlist and bind it (inside Repeater_ItemBound -
including setting checked/unchecked). Checkboxlist has Autopostback=true so whenever I click on checkbox, the page is submitted to the server.

Here starts my problem:
I am not able to capture the click event of checkbox list to find out which checkbox was clicked (which generated click event) and retrieve the value
associated with it (for further processing).
I have List_SelectedIndexChanged function but it never fires. I am obviously missing something, I don't undestand event bubling enough.
Any idea? Any help?
Thanks
JD

Nov 18 '05 #3
Hi,

an important thing in all this is that you recreate the control before the
viewstate is restored, for info when everything happens see this link:
http://msdn.microsoft.com/library/de...nLifecycle.asp .
If the same control structure doesn't exists when the viewstate is restored
it will not be able to "discover" the events. As Marintov wrote you have
also to define where this event is going to be handled in the "tag" of the
checkbox list.

So what does all this mean, basically this (only pseudo code for how the
behind code could be structured.):
Sub Page_Init()
// code to bind your repeater
// after the page init the viewstate will be restored.
End Sub

Sub ChkBoxlist_IndexChange()
// here is your event!
// if you want to access some other control that is within the same
repeater element use the parent property of the reperater.
End Sub
I hope this clears things up
Cheers
Cristian

"marinov" <tr*@me.com> wrote in message
news:Op*************@TK2MSFTNGP10.phx.gbl...
have you tried to create the event of the checkboxlist like

<asp:CheckBoxList id=.... OnSelectedIndexChanged="YourEventName"
AutoPostBack=True>
....

this will tell to the asp.net that when a checkbox is clicked the
YourEventName event will fired, BUT you have to declare your event as Public other wise asp.net won't find it :(

Hope This Helps
Regards
Martin Marinov

"JD" <sk*****@hotmail.com> wrote in message
news:uy*************@TK2MSFTNGP09.phx.gbl...
Hello,
I have a problem with checkboxlist inside Repeater (in ASP.NET page).
I am able to create Checkboxlist and bind it (inside Repeater_ItemBound - including setting checked/unchecked). Checkboxlist has Autopostback=true

so
whenever I click on checkbox, the page is submitted to the server.

Here starts my problem:
I am not able to capture the click event of checkbox list to find out

which
checkbox was clicked (which generated click event) and retrieve the value associated with it (for further processing).
I have List_SelectedIndexChanged function but it never fires. I am

obviously
missing something, I don't undestand event bubling enough.
Any idea? Any help?
Thanks
JD


Nov 18 '05 #4

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

Similar topics

2
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter"...
7
by: Scott Schluer | last post by:
Hi All, I have a functioning datagrid on "Page 1" that displays order information for a single order (this is for an e-commerce site). It's actually a combination of a couple datagrids to...
3
by: Leigh Webber | last post by:
I have an HTMLAnchor control on my aspx page. When it's not inside a repeater, it works fine. When I put it inside a repeater control, the handler never gets fired. I have a handler for the...
3
by: I am Sam | last post by:
I keep getting the following error message when I try to iterate through a CheckBoxList control: Object reference not set to an instance of an object. Description: An unhandled exception...
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...
3
by: Shimon Sim | last post by:
I put linkbutton in a repeater header. I attached event handler in makeup as onclick="btnSort_Click". Made btnSort_Click method public. It doesn't fire if I click on it. I tried to attach it in...
2
by: Bart Van Hemelen | last post by:
The situation: I have a CheckBoxList cblTest, the items are disabled in cblTest_DataBound in a foreach (ListItem oItem in cblTest.Items) loop. I provide a link that calls a client-side JavaScript...
1
by: champ.supernova | last post by:
Hi, I have a dropdownlist which is repeated inside a repeater. What I'm wanting is for when one instance of the dropdownlist has its selection changed, for 1) this to trigger an...
3
by: | last post by:
Hi all, I have a CheckBoxList control which has about 10 items. I have set autopostback=true and also set an eventhandler for OnSelectedIndexChanged. The problem is I want to identify which...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.