Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello friendssss,

how to avoid page refresh when checkbox selected in asp.net webpage.
my project is based on asp.net c#, and database as sqlserver

when i select checkbox, page is refreshing...I want to avoid page refreshing.
and also page is refreshing on submit button click.

please I required help to avoid page refreshing.

Thanks.
Posted
Comments
bbirajdar 25-Nov-12 5:29am    
Use html controls instead

Use the update panel control

Details...
 
Share this answer
 
Comments
Ranjith Reddy CSE 25-Nov-12 6:49am    
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
RelicV 26-Jun-13 8:57am    
Dude, try to have a look into that link provided by Mahmud. You've already specified that you wrote (or still writing..?) code for that CheckedChanged Event..
Hi Ranjit

1] Remove Autopostback="true" property from Check Box it won't refresh Page when you will
checked the Checkbox.

2] Use Update Panel. put Checkbox,Button in Content Template and Put Below Line for making
page partially post back.

<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">

<asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">
<contenttemplate>
<asp:checkbox id="CheckBox1" runat="server">
<asp:button id="Button1" runat="server" text="Button">

<triggers> <asp:asyncpostbacktrigger controlid="Button1">
 
Share this answer
 
Comments
Ranjith Reddy CSE 25-Nov-12 6:49am    
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
Hi Ranjit

1] Remove Autopostback="true" property from Check Box it won't refresh Page when you will
checked the Checkbox.

2] Use Update Panel. put Checkbox,Button in Content Template and Put Below Line for making
page partially post back.

<asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown">

<asp:updatepanel id="UpdatePanel1" runat="server" xmlns:asp="#unknown">
<contenttemplate>
<asp:checkbox id="CheckBox1" runat="server">
<asp:button id="Button1" runat="server" text="Button">

<triggers> <asp:asyncpostbacktrigger controlid="Button1">
 
Share this answer
 
Comments
Ranjith Reddy CSE 25-Nov-12 6:49am    
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
I think you should use Update Panel.Here is the code for UpdatePanel..
You should include your button and all checkbox inside it.
XML
<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server">

                <ContentTemplate>

                    <asp:Label ID="Label" runat="server" Text="Label"></asp:Label>

                    <br/>

                    <asp:Button ID="Button" runat="server" onclick="Button_Click" Text="Update"/>

                </ContentTemplate>

            </asp:UpdatePanel>
 
Share this answer
 
Comments
Ranjith Reddy CSE 25-Nov-12 6:49am    
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
the above solution is almost correct but you need to set AutoPostBack="false" for avoide the postback when you check checkbox.
 
Share this answer
 
just check the autopost property of checkbox.....keep it true.....no need to do any thing
 
Share this answer
 
You have two option for that

1) Set AutoPostBack="False"

if you want AutoPostBack="True"

then,

2) Use UpdatePanel...

C#
<asp:scriptmanager id=""ScriptManager1"" runat=""server"><br" mode="hold" xmlns:asp="#unknown" />        </asp:ScriptManager>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server">

                <ContentTemplate>

                  Put checkbox here...


                </ContentTemplate>

            </asp:UpdatePanel>
 
Share this answer
 
v2

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