我想点击保存按钮时从文本框控件中获取文本。
<tr id="comsec2_2">
<td style="font-size: 12px; width: 109px;">Comments:<img class="popup2" id="popup_2_2" src="magnifier-left.png" alt="" /></td>
<td>
<asp:TextBox ID="TXT_Comments_Section2_2" ClientIDMode="Static" runat="server" Width="500px" Height="50px" TextMode="MultiLine"></asp:TextBox>
</td>
</tr>
当img tapped对话框打开以添加新评论时。保存按钮保存TXT_Comments_Section2_2旧评论和新评论。
function ShowDialog2(id) {
console.log(id);
var tt2 = "";
if (id == "2_2") tt2 = $("#TXT_Comments_Section2_2").val();
$('#ROlbl1234').html(tt2);
$('#lbl1234').html("");
$("#dialog2").dialog({
height: 600,
width: 800,
modal: true,
buttons: {
'Save': function () {
if (id == "2_2") document.getElementById('TXT_Comments_Section2_2').value = $("#lbl1234").val() + "\n" + $("#ROlbl1234").val();
$("#dialog2").dialog("close");
}
},
});
}
当我点击完成按钮并尝试获取文本
Protected Sub BTN_Save_Total2_Click(sender As Object, e As EventArgs) Handles BTN_Save_Total2.Click
Steps = TXT_Steps.Text
BTN_Save_Total2.Enabled = False
Dim Web As SPWeb = SPContext.Current.Web
Dim List As SPList = Web.Lists("ConsultancyForm")
'Update list items
If (hiddenCurrentItemId.Value = String.Empty) Then
Dim UpdateItem As SPListItem = List.Items.Add()
UpdateItem("Comments") = vbCrLf & vbCrLf & "----" & now.ToString(format) & "----" & vbCrLf & TXT_Comments_Section2_2.Text
UpdateItem.Update()
....
控件没有新值。当我从控制台调用.val()时,我获得了新的价值。