0

so far i am successful making multiple html texboxes dynamically using a c# button but now i want to get the id's of those textboxes in codebehind(c#) in order to get their data and save it in the database. if i get a hint to get id's of textboxes then insertion in database is easy.

javascript code:

<script type="text/javascript">

        var counter = 0;

        function AddFileUpload() {

            var div = document.createElement('DIV');

            div.innerHTML = 

             'File Name: <input id="_txtFileName' + counter + '"  type="text" />' +

             'File Path: <input id="_txtFilePath' + counter + '" type="text" />' +

             '<input id="FileUpload' + counter + '" name = "FileUpload' + counter + '" type="file" />' +

             '<input id="Button' + counter + '" type="button" value="Remove" onclick = "RemoveFileUpload(this)" />';

            document.getElementById("FileUploadContainer").appendChild(div);

            counter++;

        }

        function RemoveFileUpload(div) {

            document.getElementById("FileUploadContainer").removeChild(div.parentNode);

        }

    </script>
6
  • What kind of ASP.NET application are you using (Webforms, MVC?) Commented Feb 14, 2015 at 22:13
  • @NickBailey...i am using Webforms Commented Feb 14, 2015 at 22:21
  • Not a webforms expert ), but this looks like it might help stackoverflow.com/questions/857834/… Commented Feb 14, 2015 at 22:30
  • Have you try HtmlAgilityPack? nuget.org/packages/HtmlAgilityPack Commented Feb 14, 2015 at 23:17
  • do you see the id's when you do view source on the asp.net page rendering? usually they are formane_fieldname Commented Feb 15, 2015 at 3:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.