0
これは初めての投稿です。私は数日間これで問題になってきました。あなたが見ることができるように私はJavaScriptでdivCert
にテキストフィールドを追加および削除、Javascriptで生成されたテキスト入力の値を取得し、.Netを使用して保存します。C#
<fieldset>
<legend>Certifictions</legend>
<div runat="server" id="divCert">
<input runat="server" type="button" id="btnAddCert" class="Botones" value="Agregar Certificación" onclick="AddCertification()" />
<input runat="server" type="button" id="btnRemoveCert" class="Botones" value="Quitar Certificación" onclick="RemoveCert()" />
<br/>
</div>
</fieldset>
:私は、このHTMLコードを持っています。これはコードです:今
var count1=0;
function AddCertification() {
document.getElementById("divCert").innerHTML +=
"<input type='Text' runat='server' name='txCert_" +
(count + 1) + "' class='textBox' id='txCert" + (count1 + 1) +
"' placeholder='Insert Text'/>";
count1 = count1 + 1;
}
function RemoveCert() {
var parent;
var eleRemove
if (count1 > 0) {
parent = document.getElementById("divCert");
eleRemove = document.getElementById("txCert" + (count1).toString());
parent.removeChild(eleRemove);
count1 = count1 - 1;
}else {
window.alert("There's nothing to remove");
}
}
、私がやりたいことは、aspx.csファイルの分離コードで生成されたテキストボックスの値を取得し、それを保存し、ファイルに書き込むです。このような何か:
List<Object> list = new List<object>();
foreach(TextBox found in divCer.Controls){
list.Add(found.Value);
}
私はそのコードが動作しません知っているが、それのような何かが、私は生成された各テキストボックスからの値で何をしたいのかです。
感謝します。それは役に立ちました。私の問題を解決しました。 – Richard
[when-someone-answers](http://stackoverflow.com/help/someone-answers) –