473,472 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checkbox Event Firing

Hi,
I have a Checkbox in a Repeater set to AutoPostBack = true. I have pointed
OnCheckedChanged to a Sub but it doesn't fire. If I move the checkbox out of
the Repeater it fires! Any ideas?
Thanks
Nov 18 '05 #1
3 4818
You need to wire the event during itemcreated or pageload, generally.

"Jack Turnbull" <tu***********@ntlworld.com> wrote in message
news:6Z*************@newsfe5-gui.server.ntli.net...
Hi,
I have a Checkbox in a Repeater set to AutoPostBack = true. I have pointed
OnCheckedChanged to a Sub but it doesn't fire. If I move the checkbox out of the Repeater it fires! Any ideas?
Thanks

Nov 18 '05 #2
Nested controls usually don't raise their own events. I can think of a
couple of ways to handle this: neither is elegant, only one I have done
myself.

The one I have done is to put a hidden button (visible=false) on the page
and use Javascript on the checkbox to trigger a postback as if the hidden
control had been clicked. If you need to access the specific line that
had the checkbox clicked, I would put a button inside the ItemTemplate so
that you could respond to the repeater.ItemCommand event and get the line
item. Otherwise, you can put the button outside the repeater and trigger
it.

The other way I could think of is to loop though the repeater during
postback and find out if the checkbox has changed. Not very efficient at
all. You may want that for some very odd reason.

Heres a quick code snip:

<FooterTemplate>
<input type="checkbox" ID="cmdTriggerDelete" value="Delete"
OnClick="__doPostBack('cmdDelete','click');" />
</FooterTemplate>
</asp:Repeater>

<asp:Button Runat=server ID="cmdDelete" Visible=false />

"Jack Turnbull" <tu***********@ntlworld.com> wrote in
news:6Z*************@newsfe5-gui.server.ntli.net:
Hi,
I have a Checkbox in a Repeater set to AutoPostBack = true. I have
pointed OnCheckedChanged to a Sub but it doesn't fire. If I move the
checkbox out of the Repeater it fires! Any ideas?
Thanks


Nov 18 '05 #3
Thanks Guys,
I'll take the solution to wire a hidden button - I already have a button in
each row, I'll just hide it. The idea was to get rid of it to prevent the
user getting miffed at no update on clicking the button on a different row
to the checkbox change.
Thanks & Cheers

"Jack Turnbull" <tu***********@ntlworld.com> wrote in message
news:6Z*************@newsfe5-gui.server.ntli.net...
Hi,
I have a Checkbox in a Repeater set to AutoPostBack = true. I have pointed
OnCheckedChanged to a Sub but it doesn't fire. If I move the checkbox out of the Repeater it fires! Any ideas?
Thanks

Nov 18 '05 #4

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

Similar topics

6
by: AFN | last post by:
I want to click a checkbox and have a 4 line (approx) paragraph appear beneath the checkbox, pushing the rest of the page down. And when unchecking the checkbox, the paragraph should disappear...
2
by: alien2_51 | last post by:
Can some one tell me why the onclick is firing twice for the radion button and checkbox controls...? <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Testing.aspx.vb"...
5
by: Greg Hurlman | last post by:
I've got a very simple ASCX page, where once someone finishes a section and clicks the "Next >" button, the section they just finished is disabled, and the next section appears below it, and so on....
3
by: DotNetJunkies User | last post by:
Hi, I have a checkbox control programmatically created for each row in the datagrid but CheckedChanged event not firing when state of the checkbox changes. I use the following code to...
5
by: tshad | last post by:
Is there a way to allow a user to press a radio button if it is already selected? There is an onCheckedChanged event that fires when the person presses the button and it is isn't selected...
1
by: rodchar | last post by:
hey all, is the following even possible? i have a datagrid with checkboxes on each row, when a user clicks on the checkbox i'd like to populate one of the fields in the grid with the current...
2
by: dilip.movva | last post by:
Hi, In the ItemDataBound of my datagrid I am creating a checkbox dynamically. I have the eventhandler defined for CheckedChanged of the check box. The event is not firing. The grid is bound in the...
2
by: Deano | last post by:
I have a subform that is populated by a table that holds lots of yes/no values. The user sees points at the side and then periods across the top. So they decide they want point 20 for period 5...
4
by: sarabonn | last post by:
Hello everyone, Iam firing a event in the chechbox_checkedchanged. It works fine private void checkBox1_CheckedChanged(object sender, EventArgs e) { ...
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
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...
1
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,...
1
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...
0
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...
0
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...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.