473,546 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ItemBo und -
including setting checked/unchecked). Checkboxlist has Autopostback=tr ue 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_SelectedIn dexChanged 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 6677
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 "oncheckedchang ed" 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*****@hotmai l.com> wrote in message
news:uy******** *****@TK2MSFTNG P09.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_ItemBo und -
including setting checked/unchecked). Checkboxlist has Autopostback=tr ue 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_SelectedIn dexChanged 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:CheckBoxLi st id=.... OnSelectedIndex Changed="YourEv entName"
AutoPostBack=Tr ue>
.....

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*****@hotmai l.com> wrote in message
news:uy******** *****@TK2MSFTNG P09.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_ItemBo und -
including setting checked/unchecked). Checkboxlist has Autopostback=tr ue 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_SelectedIn dexChanged 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_Inde xChange()
// 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******** *****@TK2MSFTNG P10.phx.gbl...
have you tried to create the event of the checkboxlist like

<asp:CheckBoxLi st id=.... OnSelectedIndex Changed="YourEv entName"
AutoPostBack=Tr ue>
....

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*****@hotmai l.com> wrote in message
news:uy******** *****@TK2MSFTNG P09.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_ItemBo und - including setting checked/unchecked). Checkboxlist has Autopostback=tr ue

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_SelectedIn dexChanged 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
11993
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" runat="server" commandname="Filter" CommandArgument='<%#
7
1987
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 display all of the information. I now have a need to drop this datagrid into a repeater on "Page 2". The repeater will grab ALL orders within a given...
3
5669
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 htmlAnchor's ServerClick event (works when not inside a repeater), and a handler for the repeater's ItemCommand event. My html and vb source code is shown...
3
2909
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 occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the...
4
4032
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 work:( Thanks My CheckBoxList in the DataList Below
3
4117
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 ItemDataBound event but I think it is too late. What am I doing wrong? Thanks Shimon.
2
6242
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 that enables the items -- this works perfectly. However, when I then click a LinkButton that does a postback and I loop through the items on...
1
7313
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 'OnSelectedIndexChanged' subroutine, and 2) for that subroutine to be able to somehow identify which 'row' of the repeater the dropdownlist belongs to. To keep...
3
3480
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 checkbox item caused the event to fire to perform some routines based upon the value of that individual checkbox. How can I determine this? For example,...
0
7435
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...
0
7694
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. ...
0
7947
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...
1
7461
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7792
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...
0
6026
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...
0
5080
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...
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
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...

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.