Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL-Server
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 24-Nov-12 21:37pm
Comments
aspnet_regiis -i at 25-Nov-12 5:29am
   
Use html controls instead
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Use the update panel control
 
Details...
  Permalink  
Comments
Ranjith Reddy CSE at 25-Nov-12 6:49am
   
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
RelicV at 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..
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

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">

<asp:checkbox id="CheckBox1" runat="server" />
<asp:button id="Button1" runat="server" text="Button" />


<asp:asyncpostbacktrigger controlid="Button1" />

  Permalink  
Comments
Ranjith Reddy CSE at 25-Nov-12 6:49am
   
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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">

<asp:checkbox id="CheckBox1" runat="server" />
<asp:button id="Button1" runat="server" text="Button" />


<asp:asyncpostbacktrigger controlid="Button1" />

  Permalink  
Comments
Ranjith Reddy CSE at 25-Nov-12 6:49am
   
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

I think you should use Update Panel.Here is the code for UpdatePanel..
You should include your button and all checkbox inside it.
<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>
  Permalink  
Comments
Ranjith Reddy CSE at 25-Nov-12 6:49am
   
Hello Boss, am writing code in Checkbox CheckedChanged Event so, it has autopost back = True.....Please help.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

the above solution is almost correct but you need to set AutoPostBack="false" for avoide the postback when you check checkbox.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

just check the autopost property of checkbox.....keep it true.....no need to do any thing
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

You have two option for that
 
1) Set AutoPostBack="False"
 
if you want AutoPostBack="True"
 
then,
 
2) Use UpdatePanel...
 
<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>
  Permalink  
v2

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

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 26 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100