How to get values from GridView in jQuery Dialog in C# -


there jquery dialog gridview inside in aspx page. have button save on jquery dialog. need values in gridview after click on button in c#. have tried below. not worked. changed value in textbox , click save button. not gave me edited value. nothing returned.

aspx page

<asp:content id="content1" contentplaceholderid="headcontent" runat="server">    /* java scripts , style sheets here */      <script type="text/javascript">          function showdialog() {             $('#dialogdiv').dialog('open');         }          $(document).ready(function () {             $('#dialogdiv').dialog({                 autoopen: false,                 resizable: true,                 width: 300,                 height: 'auto',                 buttons: {                     "save": function () {                         $('#' + '<%= btnsavetype.clientid %>').trigger("click");                     }                 }             });         });       </script> </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server">     <asp:scriptmanager id="scriptmanager1" runat="server" enablepagemethods="true">     </asp:scriptmanager>     <div id="dialogdiv" title="type" style="overflow: hidden">         <div id="typediv" class="divtable">             <div class="divrow">                 <div class="divcolumn">                     <div>                         <asp:updatepanel runat="server" id="updatepanel1" updatemode="conditional">                             <triggers>                                 <asp:asyncpostbacktrigger controlid="open" eventname="click" />                             </triggers>                             <contenttemplate>                                 <asp:gridview id="type_gv" runat="server" showfooter="true" autogeneratecolumns="false">                                     <columns>                                         <asp:templatefield headertext="type">                                             <itemtemplate>                                                 <asp:textbox id="txttype" runat="server" text='<%# bind("type") %>'></asp:textbox>                                             </itemtemplate>                                         </asp:templatefield>                                     </columns>                                 </asp:gridview>                             </contenttemplate>                         </asp:updatepanel>                     </div>                 </div>             </div>         </div>     </div>     <asp:button id="open" runat="server" text="open dialog" onclick="open_clicked" onclientclick="showdialog()" />     <br />     <p>         <asp:button id="btnsavetype" runat="server" onclick="btnsavetype_clicked" style="visibility: hidden;             display: none;" />     </p> </asp:content> 

code behind

    protected void page_load(object sender, eventargs e)     {      }      protected void open_clicked(object sender, eventargs e)      {         vehicletype vtypeobject = new vehicletype();         type_gv.datasource = vtypeobject.gettypelist();         type_gv.databind();     }      protected void btnsavetype_clicked(object sender, eventargs e)     {         foreach (gridviewrow gvr in type_gv.rows)         {             textbox type = (textbox)gvr.findcontrol("txttype");             debug.writeline("type : " + type.text);             // when debug, print type :              // nothing print type.text         }     } }  public class vehicletype {     public string type { get; set; }      public list<vehicletype> gettypelist()     {         list<vehicletype> list = new list<vehicletype>()     {         new vehicletype{type="type1"}     };         return list;     } } 

how can solve ?


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -