Click here to Skip to main content
11,496,146 members (1,563 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
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
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..
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.
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.
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.
the above solution is almost correct but you need to set AutoPostBack="false" for avoide the postback when you check checkbox.
  Permalink  
just check the autopost property of checkbox.....keep it true.....no need to do any thing
  Permalink  
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 Dnyaneshwar@Pune 692
1 RyanDev 230
2 CHill60 208
3 Sascha Lefèvre 195
4 Sergey Alexandrovich Kryukov 124
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 26 Jun 2013
Copyright © CodeProject, 1999-2015
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