lundi 28 septembre 2020

checkbox checked is not changing the data in repeater's footer template

I have a data for boolean control in repeater for checking. I created a footer template for sum price total in checked and unchecked items. But I only get all total of prices.linq query is qorking but checkbox is not firing in repeater footer even checkedbox change event changes the checked. How can I fix that issue?


 string durum;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadFirmaOdemeler();
        }
    }    
 
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Footer)
    {
        var data = (DataRowView)e.Item.DataItem;

        var checkOnaySonuc = (e.Item.FindControl("checkOnaySonuc") as Label);
        if (string.IsNullOrEmpty(durum))
        {
            total = callFirma().AsEnumerable()
            .Sum(r => Convert.ToDouble(r["odemeTutari"]));
        }
        else
        {
            if (durum.Equals("1"))
            {
                total = callFirma().AsEnumerable()
                .Where(r => r.Field<string>("odemeOnayi") == "1")
            .Sum(r => Convert.ToDouble(r["odemeTutari"]));
            }
            else
            {
                total = callFirma().AsEnumerable()
                .Where(r => r.Field<string>("odemeOnayi") == "0")
            .Sum(r => Convert.ToDouble(r["odemeTutari"]));
            }
        }
    }
}

 protected void onaylandıGosterCheck_CheckedChanged(object sender, EventArgs e)
    {
        var chck = (CheckBox)sender;
        string durum = chck.Checked ? "1" : "0";
    }

and this is aspx

<FooterTemplate>
                                                <tfoot>
                                                    <tr>
                                                        <td>
                                                            <asp:Button ID="cleanTable" Text="Temizle" runat="server" CommandName="Clean" CssClass="btn btn-info" />
                                                        </td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td>
                                                            <asp:Label ID="checkOnaySonuc" Text="deneme" runat="server" />
                                                        </td>
                                                        <td></td>

                                                        <td>
                                                            <asp:CheckBox ID="onaylandıGosterCheck" Text="Onaylandı Göster" runat="server" CssClass="checkbox checkbox-info" AutoPostBack="true" OnCheckedChanged="onaylandıGosterCheck_CheckedChanged" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                        <td></td>
                                                    </tr>
                                                </tfoot>


                                            </FooterTemplate>



Aucun commentaire:

Enregistrer un commentaire