Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically add multiple controls

Status
Not open for further replies.

Affleck

Technical User
Jun 19, 2001
26
GB
Hi,

I am trying to create a web form that allows users to upload files. I want to be able to provide the user with a link to add as many FileInput conrols as they need since they may have more than 1 file to upload. I can create a static version of this no problem.

I have a linkButton that is wired to the following method that should (in theory) add a new HtmlInputFile to a placeholder..

private void addFileUpload_Click(object sender, System.EventArgs e)
{
plc_files.Controls.Add(new System.Web.UI.HtmlControls.HtmlInputFile());

}


but this throws an error : Object reference not set to an instance of an object

Can anyone help please?

TIA

Affleck
 
That would suggest to me that the page doesn't know what "plc_files" is.

----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
ca8msm,

Can't believe i missed that! maybe I should sleep more.

Thanks!!

there are 10 types of people in this world those who understand binary, and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top