samedi 14 février 2015

Get the ID's of the html textboxes made by javascript using c#


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>




Aucun commentaire:

Enregistrer un commentaire