Click here to Skip to main content
16,021,580 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am using asp.net web from and creating dynamic controls using javascript but not able to find control using their name.

What I have tried:

var files = Request.Files;
                
                List<string> Settlement_Offer_Details = files.AllKeys.Where(n => n.StartsWith("fileSO")).ToList();
                Settlement_Offer_Details.Add(fileSO.Name);

                foreach (var item in Settlement_Offer_Details)
                {
                    ContentPlaceHolder content = Page.Master.FindControl("MainContent") as ContentPlaceHolder;
                    FileUpload fu = content.FindControl(item) as FileUpload;
                    //FileUpload tb = FindControl(item) as FileUpload;
                }



Using below code able to got details of file but want to know their control name as we are using dynamic creation for 2 different panels .So, it's necessary to know from where this data is coming either from panel 1 or panel2

for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFile PostedFile = Request.Files[i];
if (PostedFile.ContentLength > 0)
                    {
                        string FileName = System.IO.Path.GetFileName(PostedFile.FileName);
                        PostedFile.SaveAs(Server.MapPath("Files\\") + FileName);
                    }
                }
Posted
Updated 6-Jul-22 1:28am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900