Checkbox CheckedChanged无法正常工作

时间:2016-09-27 17:41:21

标签: asp.net

我正在创建一个带有复选框的.aspx页面,当它被选中时,必须更改收音机列表的可见性。 当我检查它时,显示了无线电列表,但是当我取消选中它时,无线电列表不会消失。 所以,我的代码就是:

前端

 $('#container').each(function () {
    var publico = 2111;
    var abordados = 748;
    chart = new Highcharts.Chart({
        chart: {
            renderTo: this,
            type: 'column',
            margin: 0,
            spacingTop: 0
        },
        title: {
            text: ''
        },
        xAxis: {
            categories: [
            'Público',
            'Abordados',
            'Conversão'
            ], title: {
                text: null
            },
            labels: {
                style: {
                    fontSize: '9px',
                    font: '9px Arial, Helvetica'
                },
                enabled: false
            }
        },
        yAxis: {
            endOnTick: false,
            maxPadding: 0.1,
            gridLineColor: 'transparent',
            minorTickLength: 0,
            tickLength: 0,
            min: 0,
            title: {
                text: ''
            },
            labels: {
                enabled: false
            }
        }, tooltip: {
            pointFormat: ' <b>{point.y}</b> ',
            shared: true
        },
        legend: {
            enabled: false
        },
        plotOptions: {
            bar: {
                slicedOffset: 0,
                size: '100%',
                dataLabels: {
                    enabled: false
                }
            },
            series: {
                slicedOffset: 0,
                shadow: false,
                borderWidth: 0,
                dataLabels: {
                    enabled: true,
                    formatter: function () {
                        if(this.x == 'Conversão'){
                            return Math.round(this.y / abordados * 100, 0) + '%';
                        }else{
                            return Math.round(this.y / publico * 100, 0) + '%';
                        }
                    }
                }
            }
        },
        legend: {
            itemStyle: {
                fontSize: '8px',
                font: '8px Arial, Helvetica'
            },
            enabled: false
        },
        credits: {
            enabled: false
        },
        series: [{
            data: [
                { y:publico, color: '#199ED8' },
                { y:abordados, color: '#6CF' },
                { y:433, color: '#6FF' }
            ],
            connectNulls: true,
            pointWidth: 58
        }], exporting: {
            buttons: {
                contextButton: {
                    enabled: false
                }
            }
        }
    });
});

返回端

<asp:CheckBox ID="ckbProspect" runat="server" AutoPostBack="true" 
                            oncheckedchanged="ckbProspect_CheckedChanged" />
                        <asp:RadioButtonList ID="rbListProspect" runat="server" Visible="false" 
                            AutoPostBack="true" RepeatDirection="Horizontal">
                            <asp:ListItem Value="1" Text="Sim"></asp:ListItem>
                            <asp:ListItem Value="0" Text="Não"></asp:ListItem>
                        </asp:RadioButtonList>

我如何解决这个问题以及它的错误?

1 个答案:

答案 0 :(得分:1)

试试这个:

<asp:CheckBox ID="ckbProspect" runat="server" Checked="false"
    OnCheckedChanged="ckbProspect_CheckedChanged" AutoPostBack="true"/>

P.S:我相信您的代码没有任何问题,它的工作正常。

outp