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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:38:53+00:00 2026-05-23T14:38:53+00:00

I have a web application. On my page ive got this: <div id=myDiv runat=server

  • 0

I have a web application.
On my page ive got this:

<div id="myDiv" runat="server" />
//and a button that will call a method to save my inputs

on code behind i have this :

    protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);

    if (!this.IsPostBack)
    {
        .....
    }
    LoadForm(); // this will create a textbox with values inside it and a button called change
                   // into the div .
                   //when i click the button , it will create a fileupload control
                  //and add this control into the div
}

my problem is:
when i first click the button change it will change the textbox and the button to an upload control, no problem with this one, but when i click the save button, on load the page will re-pass from the LoadForm() letting my page create a textbox, while i had changed it to an upload file, how can i solve this???
I dont know if i should add more details, or its clear,
thanks in advance

private void LoadForm()
        {
            ....
            button.Click += new EventHandler(button_Click);
            this.myDiv.Controls.Add(textBox);
            this.myDiv.Controls.Add(button);
    }
void button_Click(object sender, EventArgs e)
        {
            ...
            this.myDiv.Controls.Clear();
            this.myDiv.Controls.Add(here will be the fileupload control);
    }
  • 1 1 Answer
  • 3 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-23T14:38:54+00:00Added an answer on May 23, 2026 at 2:38 pm

    The problem is that because you are creating the file upload dynamically, for it to show up again, it has to be re-added to the page. An option here would be to always have the control on the page, just toggle the visibility.

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

Sidebar

Related Questions

I have a web application that has a page that loads the content from
I have a web page that links to another web application, which unfortunately only
I have this web application using Spring Web Flow framework. In my main page
I have made a web application that uses master page for Login & Logout
I have a web application in Asp.Net. I've created my master page and inside
I have a web application and on page is an update page to update
I have a web application where I am doing a Response.Redirect(Register.aspx) page in a
We have a Web application (ASP.NET) which displays in some page links to miscellaneous
Hi i have a web application where i plant a cookie on my page.
I have a one page web application, which means alot of javascript. External scripts

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.