[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

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,
0
Sebastian_OH
Asked:
Sebastian_OH
  • 2
1 Solution
 
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

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now