Click here to Skip to main content
15,902,198 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my form I have one checkbox (Unchecked state on load).by clicking this checkbox I have to load all the details in dropdown.if unchecked It will load minimum details in dropdown.
Problem:
At first, I have checked the checkbox then unchecked it.Then I just refreshing the page.
That time the checkbox become automatically checked. and other controls like radiobuttions in this page become disabled.Please help me to solve this problem.???
Code
----------
XML
<asp:UpdatePanel ID="updChkAllPort" runat="server" UpdateMode="Always">
                                    <contenttemplate>
                        <div class="table_column_50" style="margin-left: -3px ! important"   runat="server"
                            id="divSelecAllPort">
                            <asp:CheckBox runat="server" ID="chListAllPort"  Checked ="false"  Text="List all ports" OnCheckedChanged="chListAllPort_changed" AutoPostBack="true" 
                                CssClass="checkbox-style" SkinID="label-style-data"  />
                        
                         </contenttemplate>


----------------------

// checkbox chaged
------------------------
C#
protected void chListAllPort_changed(object sender, EventArgs e)
    {
        List<crewport> nextPort = new List<crewport>();
        nextPort = CrewReliefPlannerManager.CrewLastPortList(Convert.ToInt32(hidVesselId.Value), chListAllPort.Checked ? true : false);
        ddlPort.DataSource = nextPort;
        ddlPort.ValueField = "PortId";
        ddlPort.TextField = "PortName";
        ddlPort.DataBind();
        ddlPort.NullText = Resources.ErrorMessage.ResourceManager.GetString("Drop_Down_Select").ToString();

    }
Posted
Updated 10-Sep-14 4:06am
v2

1 solution

Then you should set AutoPostBack=false, this will prevent page from posting back on check/uncheck.
 
Share this answer
 
Comments
jithesh a 11-Sep-14 0:23am    
Thank you for your response.
If I set AutoPostBack=false ,how its possible to load the dropdown based on checkbox click? I need to maintain the control's state to its original state after page refresh.. (ie. checkbox unhecked and radiobuttons get enabled after page refresh)
please help me...

regards
Jithesh

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900