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

  • Home
  • SEARCH
  • 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 8409487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:55:29+00:00 2026-06-09T23:55:29+00:00

<asp:CheckBox ID=chkBox1 runat=server Text=1 /> <asp:CheckBox ID=chkBox2 runat=server Text=2 /> I have two checkbox,

  • 0
<asp:CheckBox ID="chkBox1" runat="server" Text="1" />
<asp:CheckBox ID="chkBox2" runat="server" Text="2" />

I have two checkbox, Based up on the Selection i need to run query and bind into repeater control.

In Repeater Control:

<asp:Repeater runat="server" ID="Repeater1">
<HeaderTemplate >
<table class="list_table" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<th>1</th>
<th>2</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%=CheckBox1.Checked ? Eval("1") : "" %></td> 
 <td><%=CheckBox2.Checked ? Eval("2") : "" %></td> 

    </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </FooterTemplate>
    </asp:Repeater>

AVD suggestion i have changed my coding, if condition is working fine, but i need to bind the data from database into the repeater control.

  • 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-09T23:55:30+00:00Added an answer on June 9, 2026 at 11:55 pm

    You can try,

     <ItemTemplate>
        <tr>
            <td><%=CheckBox1.Checked ? "1" : "" %></td>
            <td><%=CheckBox2.Checked ? "2" : "" %></td>
       </tr>
      </ItemTemplate>
    

    EDIT:

    @Prince Antony G : If I select checkbox1 then run the query- select 1 from table1; or if I select checkbox2 then run the query- select 2 from table2; and bind the data into my repeater control (and both these tables have different fields)

    You can’t bound different data source to a DataControl because some of the binding expression (columns) are not available(found) in either of that case.

    Page1.aspx markup


    <div>
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
            <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <!--Bind the result from first table -->
            </ItemTemplate>
            </asp:Repeater>
        </asp:View>
    
        <asp:View ID="View2" runat="server">
            <asp:Repeater ID="Repeater2" runat="server">
            <ItemTemplate>
                <!--Bind the result from second table -->
            </ItemTemplate>
            </asp:Repeater>
        </asp:View>
    </asp:MultiView>
    </div>
    

    Page1.aspx.cs – code behind


    protected void BindResult(object sender, EventArgs e)
    {
        CheckBox check = sender as CheckBox;
        switch (check.Text)
        {
            case "1": 
                /* 
                    * 1. Execute - Select * from Table1
                    * 2. Bind the DataSource to Repeater1
                    */
                /* Shows the first View*/
                MultiView1.ActiveViewIndex = 0;
                break;
            case "2":
                /* 
                    * 1. Execute - Select * from Table2
                    * 2. Bind the DataSource to Repeater2
                    */
                /* Shows the second View*/
                MultiView1.ActiveViewIndex = 1;
                break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my check box control as shown. <ItemTemplate> <asp:CheckBox ID=chkdelete runat=server Text='<%# Bind(OrderNumber)
I have a checkbox and radiobuttonlist defined as follows: <asp:CheckBox id=chkChange runat=server text=Enable />
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server
I have a GridView with a Checkbox on the first column: <asp:GridView ID=dgNumeradores runat=server
I have this code: <asp:CheckBox ID=chkLivrareExterna runat=server OnCheckedChanged=ChkLivrare_CheckedChanged AutoPostBack=true ToolTip=<%= getChkLivrareExternaToolTip() %>/> and the
I have some checkboxes in vb.net code. <tr> <td colspan=2> <asp:CheckBox ID=chkbxCreateAmendOrg runat=server Checked=False
I hava a datalist in side that I have checkbox <asp:DataList ID=dlst1 runat=server RepeatDirection=Horizontal
I have a Repeater (ASP.Net). <asp:Repeater ID=rep runat=server> <ItemTemplate> <asp:TextBox runat=server ID=txt></asp:TextBox> <asp:CheckBox runat=server
I have a repeater which has a checkBox in the headerTemplate <asp:Repeater ID=myRepeater runat=Server>
I have a CheckBox on an ASP.NET Content Form like so: <asp:CheckBox runat=server ID=chkTest

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.