Controls down show up in my Application Namespace

Hi,
i am using Visual Studio 2008 to create a web application.
For some reason, certain controls will not be added automatically to the design file (Namespace).
I am able to create a entry manually, but it is deleted after a rebuild of the project.
The control im working with is the FileUpload control.

Thanks,
LVL 3
Sebastian_OHAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alfred A.Commented:
Hi,

Have you tried removing the current FileUpload control, rebuild it, and then replace it again with another FileUpload control.  Also, be sure to copy your existing code done against your FileUpload control.  Your current FileUpload control might be corrupted.  

Editing the aspx.designer.vb directly is not advisable as this is regenerated from time to time depending on the changes to your code.  
0
Sebastian_OHAuthor Commented:
Ok i found the Problem.

The File Upload Control in inside a FormView. I have to use the FindControl function to assign the value to the Control.

Below the File Upload control i have a Button to Upload the file. If i use the click event, i can the formview.findcontrol is null!!

Is there another way to fire the button event ?
0
Alfred A.Commented:
Hi,

You can try to find the button using FindControl by doing recursion.  I am not sure if you are using VB or C# but you can try to following code.  The code below finds all controls within your control.  For example, FindControlRecursive(FormView, "btnThatINeed")
public Control FindControlRecursive(Control Root, string  Id)

{

    if (Root.ID == Id)

        return Root;

 

    foreach (Control Ctl in Root.Controls)

    {

        Control FoundCtl = FindControlRecursive(Ctl, Id);

        if (FoundCtl != null)

            return FoundCtl;

    }

 

    return null;

}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.