Solved

Checkbox in a repeater not firing event

Posted on 2008-06-17
4
459 Views
Last Modified: 2008-08-13
I have a checkbox in a repeater.  I need it to call my event handler in the code when the user clicks on it.
I tried onlick & onserverclick events with no luck.

<input type="checkbox" id="chkBox1" runat="server"  onclick="OnClickCheckBox"

event handler:
protected void OnClickCheckBox(object oSender, EventArgs oEventArgs)
{
   int x=0; << does not go here!
}
0
Comment
Question by:ramrocket
  • 2
4 Comments
 
LVL 10

Expert Comment

by:margajet24
Comment Utility
aren't you suppose to use ASP controls?.. and not HTML elements?..

i think if you want to handle the event, use javascript..
0
 
LVL 10

Accepted Solution

by:
margajet24 earned 100 total points
Comment Utility
<asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" AutoPostBack=true/>

    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        // code here
    }

---------
enable AutoPostBack
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now