Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6627625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:02:09+00:00 2026-05-25T22:02:09+00:00

I am a relatively new developer, and have only been doing this for about

  • 0

I am a relatively new developer, and have only been doing this for about 6 months full time, so thank you in advance for reading and/or responding to my question

I have a databound repeater. Inside this repeater, I have a gridview, SQLDS, and 2 checkboxes. Both checkboxes have a OnCheckedChanged event and AutoPostback is set to true. The repeater has an OnItemDataBound event as well.

Here is a sample of how my code is laid out:

    <asp:Repeater ID="Repeater1" OnItemDataBound="Repeater1_ItemDataBound">
        <ItemTemplate>
            <asp:Panel>
                <asp:UpdatePanel>
                    <ContentTemplate>
                        <asp:Checkbox ID="Checkbox1" Autopostback="True" OnCheckedChanged="CheckBox1_CheckedChanged">
                        <asp:Checkbox ID="Checkbox2"Autopostback="True" OnCheckedChanged="CheckBox2_CheckedChanged">
                        <asp:Gridview ID="Gridview1" DataSourceID="SqlDataSource1">
                        <asp:SQLDataSource ID="SQLDataSource1" SelectCommand="SP1" SelectCommandType="StoredProcedure">
                    </ContentTemplate>
                </asp:UpdatePanel>
            </asp:Panel>
        </ItemTemplate>
    </asp:Repeater>

And the C#

    protected void Checkbox1_CheckedChanged(object sender, EventArgs e)
    {
        if (Checkbox1.Checked == true)
            {
                if (Checkbox2.Checked == true)
                    SqlDataSource1.SelectCommand = "SP1";
                else
                    SqlDataSource1.SelectCommand = "SP2";
            }
            else
                SqlDataSource1.SelectCommand = "SP3";
    }
    protected void Checkbox2_CheckedChanged(object sender, EventArgs e)
    {
        if (Checkbox2.Checked == true)
            {
                if (Checkbox1.Checked == true)
                    SqlDataSource1.SelectCommand = "SP3";
                else
                    SqlDataSource1.SelectCommand = "SP2";
            }
            else
                SqlDataSource1.SelectCommand = "SP1";
    }

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        //Uses FindControl to Databind the GV and hides it if GV.Rows.Count==0
    }

I’m doing all of this within an AJAX TabPanel. I have another page where this code works perfectly, but it’s not inside a repeater on that other page.

Essentially, I have a page load with a gridview, and the two checkboxes change what SP fills the gridview. The problem I’m having is that when you uncheck the checkbox (they start checked), it 1. Just rechecks itself and 2. Doesn’t hit the CheckedChanged event.

Any help would be GREATLY appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:02:10+00:00Added an answer on May 25, 2026 at 10:02 pm

    The Autopostback on the checkboxes is causing the SQLDatasource to just revert to the original Stored Procedure, as it hits page load and just ignores the oncheckchanged events.

    What I did is I took all of my databinding events in pageload and put them inside of a if (!IsPostBack) clause, so that when the Autopostback hits, it doesn’t rebind the SQLDS to the original value.

    This way, when the autopostback occurs, there’s nothing for it to do, and it hits the OnCheckedChanged events as it’s supposed to.

    Thank you everyone for reading and responding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been pondering about this for some time. How do you pick a
I am 'relatively new' to unit-testing and TDD. Only more recently have I completed
I am relatively new Java developer that's been thrown in the deep end, my
I am a relatively new Android developer but have gotten pretty familiar with the
Being relatively new to functional programming, I expend lots of energy wondering is this
I'm relatively new to J2ME and about to begin my first serious project. My
I'm relatively new to web application programming so I hope this question isn't too
I'm relatively new to Nant, what i'd like to do is have a task
Relatively new Windows Phone developer here, looking for some help. Basically I'm messing around
I'm running Visual Studio 2010 on a terminal server, and have been, with relatively

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.