admin管理员组文章数量:1353245
I have Asp text box in < div> tag which after click on "btnReply",< div> showes by Jquery Dialog, so user write idea at text box and click "Send" button (jquery dialog button) and post back happend.
but the asp text box value at server side is null . Why ? my code is here :
<div id="ReplyDiv" style="display:none;">
<asp:TextBox ID="txtReply" runat="server" Textmode="MultiLine"/>
</div>
<input type="button" id="btnReply" onclick="javascript:retuen ShowReplyDialog();"/>
<asp:Button ID="AspBtnReply" runat="server" OnClick="AspBtnReply_Click" class="hidden"/>
/*-----Jquery script----*/
<script type="text/javascript">
function ShowReplyDialog()
{
$("#ReplyDiv").dialog({
width: 580,
buttons: {
"Close": function () { $(this).dialog("close");} ,
"Send" : function () {
//----Call Asp server method here
$("#<%=AspBtnReply.ClientID %>").click();
}
}
}).parent().appendTo($("form:first"));
}
</script>
I have Asp text box in < div> tag which after click on "btnReply",< div> showes by Jquery Dialog, so user write idea at text box and click "Send" button (jquery dialog button) and post back happend.
but the asp text box value at server side is null . Why ? my code is here :
<div id="ReplyDiv" style="display:none;">
<asp:TextBox ID="txtReply" runat="server" Textmode="MultiLine"/>
</div>
<input type="button" id="btnReply" onclick="javascript:retuen ShowReplyDialog();"/>
<asp:Button ID="AspBtnReply" runat="server" OnClick="AspBtnReply_Click" class="hidden"/>
/*-----Jquery script----*/
<script type="text/javascript">
function ShowReplyDialog()
{
$("#ReplyDiv").dialog({
width: 580,
buttons: {
"Close": function () { $(this).dialog("close");} ,
"Send" : function () {
//----Call Asp server method here
$("#<%=AspBtnReply.ClientID %>").click();
}
}
}).parent().appendTo($("form:first"));
}
</script>
Share
Improve this question
edited Aug 30, 2013 at 8:05
Harry Sarshogh
asked Aug 30, 2013 at 7:54
Harry SarshoghHarry Sarshogh
2,2073 gold badges28 silver badges48 bronze badges
3 Answers
Reset to default 5After a lot of search i understand to have some reasons :
I can solved it **Jquery UI Dialog need z-index style ** . i mean :
<style> .ui-widget-overlay { z-index:0; } </style>
And need jquery :
$("#..").dialog(.....).parent().parent().appendTo($("form:first"));
It's been a while since I used UpdatePanels, but I believe that on partial postback they only send updated values for controls inside them. So move the TextBox inside the UpdatePanel, or perhaps use Javascript to populate a hidden control inside the UpdatePanel with the contexts of the TextBox whenever it is updated.item
To get the values of the inputs in the code behind and access them through the server controls mechanism (textBox.Text), their state (and presence) needs to be persisted in the ViewState. Since you are building them with javascript, their state is not persisted, the only way you can get their values is using the Request.Form collection.
This issue said best tips : jQuery Dialog-Postback but UpdatePanel doesn't get updated**
For disable controls is best issue : Retrieving the value of a asp:TextBox
Use hidden field value to store the textbox value
var Des = $("#txtDesc").val();
$("#hid").val(Des);
hid is the id of hidden field.
I've just faced the same issue and after two hours effort i found the form tag in my bootstrap Modal. I've removed the form tag and value is receving in backend.
本文标签: javascriptaspnet Textbox value is null when post bock with Jquery Dialog occuredStack Overflow
版权声明:本文标题:javascript - asp.net Textbox value is null when post bock with Jquery Dialog occured - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743883562a2555643.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论