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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:47:10+00:00 2026-05-27T11:47:10+00:00

I’ve been trying to do this since yesterday but can’t think of a solution.

  • 0

I’ve been trying to do this since yesterday but can’t think of a solution.
I have a repeater containing a checkbox and a fileupload, this repeater repeats numerous times depending on the content of my table. When the checkbox below the file upload is checked it shouldnt check the fileupload. I can’t think of any way to do this. Any ideas? Heres the code.

The class:

protected void UploadButton_Click(object sender, EventArgs e)
{
    String savePath = @"~/files/";
    try
    {
        foreach (RepeaterItem item in rptVrijstellingen.Items)
        {               
            FileUpload file=(FileUpload)item.FindControl("FileUpload1");
            HiddenField uid = (HiddenField)item.FindControl("hiddenid");
            CheckBox ch = (CheckBox)item.FindControl("CBupload");
            if(ch.Checked)
                Response.Write("checked");
            else
            {
                if (file.HasFile)
                {
                  String fileName = file.FileName;
                  savePath += fileName;
                  file.SaveAs(Server.MapPath(savePath + fileName));
                  tblBijlage s = new tblBijlage();
                  s.bijlageTitel = fileName;
                  s.bijlageURL = savePath;
                  s.bijlageType = "1";
                  s.fk_externvakID = Convert.ToInt16(uid.Value);
                  BLLstudent.insertFile(s);
                }
                else
                  throw new Exception("Gelieve bij alle vakken een file toe te voegen of gegeven aan mevrouw Van Orlé aan te vinken en een afspraak te maken.");
             }
             Response.Redirect("s_student_Ovrijstellingen.aspx");
          }
      }
      catch (Exception ex)
      {
          UploadStatusLabel.Text = ex.Message;                  
      }
}

The view:

<!-- language: xml -->
<asp:Repeater ID="rptVrijstellingen" runat="server">
   <HeaderTemplate></HeaderTemplate>
   <ItemTemplate>
      <h2><%# Eval("tblExternVak.ExternvakNaam") %></h2>
      <asp:HiddenField ID="hiddenid" Value='<%# Eval("tblExternVak.pk_externvakID") %>' runat="server" />       
      <h4>Selecteer een bestand om te uploaden:</h4>
      Gelieve het bestand de naam te geven van het overeenkomstige vak om de verwerking vlot te laten verlopen.
       <br /><br />  <br />
       <asp:FileUpload id="FileUpload1" runat="server"></asp:FileUpload>
       <br />
       <asp:CheckBox id="CBupload" runat="server" /><asp:Label id="lblUpload" runat="server"> Geleverd aan Mevrouw Van Orlé</asp:Label>
       <hr />
    </ItemTemplate>
    <SeparatorTemplate><hr /></SeparatorTemplate>
</asp:Repeater>
<asp:Label id="UploadStatusLabel" runat="server" ForeColor="Red"></asp:Label>
<br /><br />
<asp:Button id="UploadButton" Text="volgende > " OnClick="UploadButton_Click" runat="server"></asp:Button>  

As u can see its just a logics problem… Can anyone give me an example on how to solve this?

  • 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-27T11:47:11+00:00Added an answer on May 27, 2026 at 11:47 am

    You are probably binding items to the repeater during the Page Load. Are you checking for PostBack?

    What I think is happening is that when you click the button the page is reloaded and the repeater gets filled with your data, overwriting the checkbox choices you have made. Just make sure you do something like this in your Page Load:

    if(!Page.IsPostBack)
    {
        //Fill repeater with items here
    }
    

    Now when you read out the repeater items after the button click you should see the actual value of the checkboxes instead of it always being false.

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
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 have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I am trying to loop through a bunch of documents I have to put

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.