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 8434069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:33:28+00:00 2026-06-10T06:33:28+00:00

I’m developing a scoring sheet app and I have a repeater with a radio

  • 0

I’m developing a scoring sheet app and I have a repeater with a radio buttons, when I check a radio, a popup shows up. it works fine. but the problem is whenever I check the next radio in the other row I get duplicate popups (one for the new radio and the other one for the previous checked radio. and it happens for all the row of the repeater (if I check 20 radios in 20 rows it will display 20 popup at the same time). I need the radios to remain checked all the time but because Autopost will fire the code behind them every time.

the code was under the repeater’s PreRender event, but someone suggested that I take it out of the repeater. (by the way what is the difference between the PreRender and ItemDataBound events?) please help.

this is my code:

namespace GAPP
{
    public partial class GRADE : System.Web.UI.Page
{
    bool rdchk = false;

    protected void Page_Load(object sender, EventArgs e)
    {

        //-----------to define an event handler for the RadioButton control inside a repeater----------

        this.rptr1.ItemDataBound += new RepeaterItemEventHandler(rptr1_ItemDataBound);



        if (IsPostBack)
        {


            for (int i = 0; i < this.rptr1.Items.Count; i++)
            {
                RadioButton RDB1 = rptr1.Items[i].FindControl("L1") as RadioButton;
                RadioButton RDB2 = rptr1.Items[i].FindControl("L2") as RadioButton;
                RadioButton RDB3 = rptr1.Items[i].FindControl("L3") as RadioButton;
                RadioButton RDB4 = rptr1.Items[i].FindControl("L4") as RadioButton;
                RadioButton RDB5 = rptr1.Items[i].FindControl("R1") as RadioButton;
                RadioButton RDB6 = rptr1.Items[i].FindControl("R2") as RadioButton;
                RadioButton RDB7 = rptr1.Items[i].FindControl("R3") as RadioButton;
                RadioButton RDB8 = rptr1.Items[i].FindControl("R4") as RadioButton;

                RDB1.AutoPostBack = true;
                RDB1.CheckedChanged += new EventHandler(RDBX1_CheckedChanged);
                RDB2.AutoPostBack = true;
                RDB2.CheckedChanged += new EventHandler(RDBX2_CheckedChanged);
                RDB3.AutoPostBack = false;
                RDB3.CheckedChanged += new EventHandler(RDBX2_CheckedChanged);
                RDB4.AutoPostBack = true;
                RDB4.CheckedChanged += new EventHandler(RDBX2_CheckedChanged);
                RDB5.AutoPostBack = true;
                RDB5.CheckedChanged += new EventHandler(RDBX1_CheckedChanged);
                RDB6.AutoPostBack = true;
                RDB6.CheckedChanged += new EventHandler(RDBX2_CheckedChanged);
                RDB7.AutoPostBack = false;
                RDB7.CheckedChanged += new EventHandler(RDBX2_CheckedChanged);
                RDB8.AutoPostBack = true;
                RDB8.CheckedChanged += new EventHandler(RDBX2_CheckedChanged);

            }

        }
    }

    //----------------------------end of define event-----------------------------------------


    private void RDBX1_CheckedChanged(Object sender, EventArgs e)
    {

        foreach (RepeaterItem item in rptr1.Items)
        {
            if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
            {
                AjaxControlToolkit.ModalPopupExtender mpex1 = (AjaxControlToolkit.ModalPopupExtender)item.FindControl("ModalPopupExtender1");
                AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)item.FindControl("ModalPopupExtender2");

                Button bsr1 = (Button)item.FindControl("btn_saveRep1");
                Button bsr2 = (Button)item.FindControl("btn_saveRep2");
                Button bsr3 = (Button)item.FindControl("btn_repeat_cnxl1");
                Button bsr4 = (Button)item.FindControl("btn_repeat_cnxl2");
                RadioButton l1 = (RadioButton)item.FindControl("L1");
                RadioButton r1 = (RadioButton)item.FindControl("R1");

                if (l1.Checked && rdchk == false)
                {
                    bsr1.Visible = true;
                    bsr2.Visible = false;
                    bsr3.Visible = true;
                    bsr4.Visible = false;
                    mpex2.Show();

                }


                if (r1.Checked && rdchk == false)
                {
                    bsr1.Visible = false;
                    bsr2.Visible = true;
                    bsr3.Visible = false;
                    bsr4.Visible = true;
                    mpex2.Show();
                }



            }

        }

    }

    private void RDBX2_CheckedChanged(Object sender, EventArgs e)
    {

        foreach (RepeaterItem item in rptr1.Items)
        {
            if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
            {
                AjaxControlToolkit.ModalPopupExtender mpex1 = (AjaxControlToolkit.ModalPopupExtender)item.FindControl("ModalPopupExtender1");
                AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)item.FindControl("ModalPopupExtender2");
                RadioButton l2 = (RadioButton)item.FindControl("L2");
                if (l2.Checked) mpex1.Show();



                RadioButton l4 = (RadioButton)item.FindControl("L4");
                if (l4.Checked) mpex1.Show();

                RadioButton r2 = (RadioButton)item.FindControl("R2");
                if (r2.Checked) mpex1.Show();



                RadioButton r4 = (RadioButton)item.FindControl("R4");
                if (r4.Checked) mpex1.Show();


            }

        }

    }




    protected void rptr1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {





    }

    protected void rptr1_PreRender(object sender, EventArgs e)
    {


        foreach (RepeaterItem item in rptr1.Items)
        {
            if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
            {
                CheckBox chb = (CheckBox)item.FindControl("chkb_NO");
                Label lbl1 = (Label)item.FindControl("lbl_dg_task");
                Label lbl2 = (Label)item.FindControl("lbl_dg_seq");
                Label lbl3 = (Label)item.FindControl("lbl_dg_repeat1");
                Label lbl4 = (Label)item.FindControl("lbl_dg_final1");
                RadioButton l1 = (RadioButton)item.FindControl("L1");
                RadioButton l2 = (RadioButton)item.FindControl("L2");
                RadioButton l3 = (RadioButton)item.FindControl("L3");
                RadioButton l4 = (RadioButton)item.FindControl("L4");
                RadioButton r1 = (RadioButton)item.FindControl("R1");
                RadioButton r2 = (RadioButton)item.FindControl("R2");
                RadioButton r3 = (RadioButton)item.FindControl("R3");
                RadioButton r4 = (RadioButton)item.FindControl("R4");
                AjaxControlToolkit.ModalPopupExtender mpex1 = (AjaxControlToolkit.ModalPopupExtender)item.FindControl("ModalPopupExtender1");
                AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)item.FindControl("ModalPopupExtender2");
                Button bsr1 = (Button)item.FindControl("btn_saveRep1");
                Button bsr2 = (Button)item.FindControl("btn_saveRep2");
                Button bsr3 = (Button)item.FindControl("btn_repeat_cnxl1");
                Button bsr4 = (Button)item.FindControl("btn_repeat_cnxl2");




                //-----------------------------

                if (chb.Checked == true)
                {

                    l1.Enabled = false;
                    l2.Enabled = false;
                    l3.Enabled = false;
                    l4.Enabled = false;
                    r1.Enabled = false;
                    r2.Enabled = false;
                    r3.Enabled = false;
                    r4.Enabled = false;

                    l1.Checked = false;
                    l2.Checked = false;
                    l3.Checked = false;
                    l4.Checked = false;
                    r1.Checked = false;
                    r2.Checked = false;
                    r3.Checked = false;
                    r4.Checked = false;


                    lbl1.CssClass = "grayedout";
                    lbl2.CssClass = "grayedout";


                }
                else
                {
                    l1.Enabled = true;
                    l2.Enabled = true;
                    l3.Enabled = true;
                    l4.Enabled = true;
                    r1.Enabled = true;
                    r2.Enabled = true;
                    r3.Enabled = true;
                    r4.Enabled = true;



                    lbl1.CssClass = "seq";
                    lbl2.CssClass = "task";

                }

            }

        }

    }

    protected void rptr1_OnItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "saveRep1")
        {
            DropDownList ddl1 = (DropDownList)e.Item.FindControl("ddl_dg_repeat");
            RadioButtonList rbl1 = (RadioButtonList)e.Item.FindControl("radio_dg_final");
            Label lbl3 = (Label)e.Item.FindControl("lbl_dg_repeat1");
            Label lbl4 = (Label)e.Item.FindControl("lbl_dg_final1");
            AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)e.Item.FindControl("ModalPopupExtender2");

            lbl3.Text = ddl1.SelectedItem.Text;
            lbl4.Text = rbl1.SelectedItem.Text;
            mpex2.Hide();
            rdchk = true;





        }
        //------------------------------------------------------------


        if (e.CommandName == "saveRep2")
        {
            DropDownList ddl1 = (DropDownList)e.Item.FindControl("ddl_dg_repeat");
            RadioButtonList rbl1 = (RadioButtonList)e.Item.FindControl("radio_dg_final");
            Label lbl3 = (Label)e.Item.FindControl("lbl_dg_repeat2");
            Label lbl4 = (Label)e.Item.FindControl("lbl_dg_final2");
            RadioButton l1 = (RadioButton)e.Item.FindControl("L1");
            AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)e.Item.FindControl("ModalPopupExtender2");

            lbl3.Text = ddl1.SelectedItem.Text;
            lbl4.Text = rbl1.SelectedItem.Text;
            mpex2.Hide();
            rdchk = true;


        }
        //------------------------------------------------------------

        if (e.CommandName == "cnxlRepeat1")
        {
            AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)e.Item.FindControl("ModalPopupExtender2");
            RadioButton l1 = (RadioButton)e.Item.FindControl("L1");
            l1.Checked = false;
            mpex2.Hide();

        }


        //------------------------------------------------------------

        if (e.CommandName == "cnxlRepeat2")
        {
            AjaxControlToolkit.ModalPopupExtender mpex2 = (AjaxControlToolkit.ModalPopupExtender)e.Item.FindControl("ModalPopupExtender2");
            RadioButton r1 = (RadioButton)e.Item.FindControl("R1");
            r1.Checked = false;
            mpex2.Hide();

        }

        //------------------------------------------------------------

        if (e.CommandName == "rdown")
        {
            ListBox lbx1 = (ListBox)e.Item.FindControl("ListBox1");
            ListBox lbx2 = (ListBox)e.Item.FindControl("ListBox2");




            if (lbx1.SelectedIndex != -1)
            {
                lbx2.Items.Add(lbx1.SelectedItem);
                lbx1.Items.Remove(lbx1.SelectedItem);
                lbx2.SelectedIndex = -1;
            }
        }
        //------------------------------------------------------------


        if (e.CommandName == "rup")
        {
            ListBox lbx3 = (ListBox)e.Item.FindControl("ListBox1");
            ListBox lbx4 = (ListBox)e.Item.FindControl("ListBox2");


            if (lbx4.SelectedIndex != -1)
            {
                lbx3.Items.Add(lbx4.SelectedItem);
                lbx4.Items.Remove(lbx4.SelectedItem);
                lbx3.SelectedIndex = -1;
            }
        }



        //----------------------------------------------------------

        if (e.CommandName == "ddl3Databound")
        {
            DropDownList ddlr1 = (DropDownList)e.Item.FindControl("DropDownList3");
            ListBox lbx5 = (ListBox)e.Item.FindControl("ListBox1");
            lbx5.DataBind();

        }

        //----------------------------------------------------------

        if (e.CommandName == "plus")
        {
            Panel pnl1 = (Panel)e.Item.FindControl("pnlXtra");
            TextBox txtb1 = (TextBox)e.Item.FindControl("txtb_comment");
            ImageButton imgb1 = (ImageButton)e.Item.FindControl("imgBtn_xtraPlus");
            ImageButton imgb2 = (ImageButton)e.Item.FindControl("imgBtn_xtraMin");
            Label lblx1 = (Label)e.Item.FindControl("label2");

            lblx1.Text = "after";
            imgb1.Visible = false;
            imgb2.Visible = true;
            pnl1.Visible = true;


        }

    }
}

}

  • 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-06-10T06:33:29+00:00Added an answer on June 10, 2026 at 6:33 am

    Solved, I have 2 labels which gets created when I check the radio, I used them in if statment.
    so if the 2 labels have text then dont display popup.

    many thanks.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.