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
  • 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-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

In a web application, I have a page that contains a DIV that has
I have a page in my vb.net web application that needs to toss a
I have this web application that has grown to an unmanageable mess. I want
I have a Web Application that I'm trying to move from Sun Application Server
I have a web application that begins with a login page. During the verification
I have an application web.xml with the following entry: <error-page> <error-code>404</error-code> <location>/system_files/error/p_notfound.jsp</location> </error-page> However,
I have a web application that should behave differently for internal users than external
I have a web application written in C# that consumes several internal web services.
I have a web application developed with ASP.net and C# that is running on
I have a web application that is becoming rather large. I want to separate

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.