asp.net Textbox value is null when post bock with Jquery Dialog occured

前端 未结 2 1614
死守一世寂寞
死守一世寂寞 2021-01-14 08:45

I have Asp.net 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 (jquer

相关标签:
2条回答
  • 2021-01-14 09:00

    Use hidden field value to store the textbox value

    var Des = $("#txtDesc").val();
    $("#hid").val(Des);
    

    hid is the id of hidden field.

    0 讨论(0)
  • 2021-01-14 09:21

    After a lot of search i understand to have some reasons :

    1. 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"));
      
    2. 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

    3. 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.

    4. This issue said best tips : jQuery Dialog-Postback but UpdatePanel doesn't get updated**

    5. For disable controls is best issue : Retrieving the value of a asp:TextBox

    0 讨论(0)
提交回复
热议问题