shashikant singh

shashikant singh

  • NA
  • 30
  • 2.2k

OnCheckedChanged event Not Working

Jun 27 2013 6:11 AM
Hi Friends ,

aspx page inherited by master page then
OnCheckedChanged event Not Working inside gridview ,before  inherited from master page it works fine please give me suggestion..

our Code is.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GenerateWOInvoice.aspx.cs"
    MasterPageFile="~/MasterPage/PopupMasterPage.master" Inherits="Workorder_GenerateWOInvoice" Culture="auto" meta:resourcekey="PageResource1" UICulture="auto" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<%@ Register Src="~/UserControl/ucMessage.ascx" TagName="ucMessage" TagPrefix="ucMsg" %>
<%@ Register Assembly="ZedControlLib" Namespace="ZedControlLib" TagPrefix="ucControl" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="innerarea">
                            <div>
                                <strong>
                                    <asp:Label ID="lblServiceChargeDetailsText" CssClass="subheading" runat="server"
                                        Text="Service Charge Details" meta:resourcekey="lblServiceChargeDetailsTextResource1"></asp:Label>
                                </strong>
                            </div>
                            <div class="clear">
                            </div>
                            <div class="grid1">
                                <asp:Panel ID="pnlServiceCharge" runat="server" meta:resourcekey="pnlServiceChargeResource1">
                                    <asp:GridView ID="gvServiceCharge" runat="server" AutoGenerateColumns="False" CssClass="grid"
                                        GridLines="None" ItemStyle-CssClass="gridrow" AlternatingItemStyle-CssClass="gridrow1"
                                        BorderWidth="0px" CellPadding="2" Width="100%" DataKeyNames="ChargeId" OnDataBound="gvServiceCharge_DataBound"
                                        OnRowDataBound="gvServiceCharge_RowDataBound" meta:resourcekey="gvServiceChargeResource1">
                                        <FooterStyle HorizontalAlign="Left" VerticalAlign="Top" CssClass="gridfooter"></FooterStyle>
                                        <AlternatingRowStyle CssClass="gridrow1" HorizontalAlign="Left" VerticalAlign="Top">
                                        </AlternatingRowStyle>
                                        <Columns>
                                            <asp:TemplateField meta:resourcekey="TemplateFieldResource6">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="chkSelect_SC" runat="server" meta:resourcekey="chkSelect_SCResource1"
                                                        OnCheckedChanged="chkSelect_SC_CheckedChanged" AutoPostBack="true" />
                                                </ItemTemplate>
                                                <HeaderStyle CssClass="gridheader6" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Group Name" meta:resourcekey="TemplateFieldResource7"
                                                Visible="False">
                                                <ItemTemplate>
                                                    <asp:Label ID="lbltaxname" runat="server" meta:resourcekey="lbltaxnameResource1"
                                                        Text='<%# Eval("ServiceChargeCategory") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle CssClass="gridheader6" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Service Charge Category" meta:resourcekey="TemplateFieldResource8">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblServiceChargeCategory" runat="server" meta:resourcekey="lblServiceChargeCategoryResource1"
                                                        Text='<%# Eval("ServiceChargeCategory") %>'></asp:Label>
                                                </ItemTemplate>
                                                <HeaderStyle CssClass="gridheader6" />
                                            </asp:TemplateField>
                                            <asp:TemplateField HeaderText="Service Charge Amount" meta:resourcekey="TemplateFieldResource9">
                                                <ItemTemplate>
                                                    <%--  <asp:Label ID="lblServiceChargeAmount" runat="server" meta:resourcekey="lblServiceChargeAmountResource1"
                                                        Text='<%# Eval("ChargeAmount") %>'></asp:Label>--%>
                                                    <asp:TextBox ID="txtServiceChargeAmount" runat="server" Text='<%# Eval("ChargeAmount") %>'
                                                        ReadOnly="true" AutoPostBack="true" meta:resourcekey="txtServiceChargeAmountResource1"
                                                        OnTextChanged="txtServiceChargeAmount_TextChanged"> </asp:TextBox>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField meta:resourcekey="TemplateFieldResource10" Visible="False">
                                                <ItemTemplate>
                                                    <asp:Label ID="lblServiceChargeCategoryId" runat="server" meta:resourcekey="lblServiceChargeCategoryIdResource1"
                                                        Text='<%# Eval("ServiceChargeCategoryId") %>'></asp:Label><asp:Label ID="lblWarrantyStatus"
                                                            runat="server" meta:resourcekey="lblWarrantyStatusResource1" Text='<%# Eval("WarrantyStatus") %>'></asp:Label><asp:Label
                                                                ID="lblEditableFlag" runat="server" meta:resourcekey="lblEditableFlagResource1"
                                                                Text='<%# Eval("Editable") %>'></asp:Label>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                        <HeaderStyle CssClass="gridheader6" HorizontalAlign="Left" VerticalAlign="Top" />
                                        <RowStyle CssClass="gridrow" HorizontalAlign="Left" VerticalAlign="Top" />
                                    </asp:GridView>
                                    <div class="float-right">
                                        <strong>
                                            <asp:Label ID="lblServiceTotalText" runat="server" Text="Total Service Charge" meta:resourcekey="lblServiceTotalTextResource1"></asp:Label></strong><asp:TextBox
                                                ID="txtServiceTotal" ReadOnly="True" runat="server" CssClass="formfields" Text="0.00"
                                                meta:resourcekey="txtServiceTotalResource1"></asp:TextBox></div>
                                </asp:Panel>
                            </div>
                        </div>
</asp:Content>

=========Cs Code.=========

 protected void chkSelect_SC_CheckedChanged(object sender, EventArgs e)
    {
        double Total = 0;
        for (int i = 0; i < gvServiceCharge.Rows.Count; i++)
        {
            if (((CheckBox)gvServiceCharge.Rows[i].FindControl("chkSelect_SC")).Checked == true)
            {
                Label editableFlag = ((Label)gvServiceCharge.Rows[i].FindControl("lblEditableFlag"));
                TextBox editableServiceChargeAmount = ((TextBox)gvServiceCharge.Rows[i].FindControl("txtServiceChargeAmount"));

                if (editableFlag.Text == "1")
                    editableServiceChargeAmount.ReadOnly = false;
                else
                    editableServiceChargeAmount.ReadOnly = true;
            
                Total = Total + Convert.ToDouble(editableServiceChargeAmount.Text);
            }

        }
        txtServiceTotal.Text = Math.Round(Total, 2).ToString();
        lblLaborCharge.Text = Math.Round(Total, 2).ToString();
        txtTotalAfterDis.Text = Math.Round(Total, 2).ToString();
        UpdateTotalAmount();
    }