Why CheckedChanged event is not firing in Listview?
<p>I am using a list view in which i am using a label and a checkbox to populate a data from database.I have used the event CheckedChanged event in checkbox but it is not firing.
what is the solution? </p>

<p>my code behind for checkedchanged event is </p>

<pre><code> protected void chkFocusArea_CheckedChanged(object sender, EventArgs e)
{
    lblError.Text = "Error";
    CheckBox chk = (CheckBox)sender;
    ListViewDataItem item = (ListViewDataItem)chk.NamingContainer;
    int dataKey = (int)lvFocusArea.DataKeys[item.DataItemIndex]["PK_ID"];

    try
    {

        string updateQuery = "UPDATE [TABLE] SET [COLUMN3] = " +
                             Convert.ToInt32(chk.Checked) + " WHERE PK_ID =" + dataKey + " ";

        cSQLHelper.myExecuteQuery(updateQuery);
    }
    catch (Exception ex)
    {
        //log exception
        ExceptionLogger.LogException(ex);
        lblError.Text = "Error occured during updating the record.";
    }
}
</code></pre>

<p>and the mark up block is</p>

<pre><code>    &lt;asp:ListView ID="lvFocusArea" runat="server" DataKeyNames="PK_ID" OnItemDataBound="lvFocusArea_ItemDataBound"&gt;
            &lt;LayoutTemplate&gt;
                &lt;table border="0" cellpadding="1" width="400px"&gt;
                    &lt;tr style="background-color: #E5E5FE"&gt;
                        &lt;th align="left"&gt;
                            Focus Area
                        &lt;/th&gt;
                        &lt;th&gt;
                            Is Current Focused
                        &lt;/th&gt;
                    &lt;/tr&gt;
                    &lt;tr id="itemPlaceholder" runat="server"&gt;
                    &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/LayoutTemplate&gt;
            &lt;ItemTemplate&gt;
                &lt;tr&gt;
                    &lt;td width="80%"&gt;
                        &lt;asp:Label ID="lblFocusArea" runat="server" Text=""&gt;&lt;%#Eval("FOCUS_AREA_NAME") %&gt;&lt;/asp:Label&gt;
                    &lt;/td&gt;
                    &lt;td align="center" width="20%"&gt;
                        &lt;asp:CheckBox ID="chkFocusArea" runat="server" OnCheckedChanged="chkFocusArea_CheckedChanged"
                            AutoPostBack="true" /&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
            &lt;/ItemTemplate&gt;
&lt;asp:ListView&gt;
</code></pre>
