asp.net jquery build table using response.write() -
i have jquery table table: column toggle except removed column selection removing data-mode="columntoggle"
i had datatable
populated, , button on form.
what want populating data in datatable
in jquery table preserving layout. way know response.write(table_header)
loop response.write(table_rows)
response.write(table_footer)
.
but seems response.write()
not working within asp.net/jquery.
how it?
here how solve it
in aspx side
<%@ page language="vb" autoeventwireup="false" codefile="default2.aspx.vb" inherits="default2" %> <%@ import namespace="system.data" %> <%@ import namespace="system.data.sqlclient" %> <!doctype html> <script runat ="server"> function return_result() datatable ... ... return dt end function </script> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>jquery mobile demos</title> <link rel="stylesheet" href="css/themes/default/jquery.mobile-1.3.1.min.css"> <link rel="stylesheet" href="_assets/css/jqm-demos.css"> <link rel="shortcut icon" href="favicon.ico"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=open+sans:300,400,700"> <script src="js/jquery.js"></script> <script src="_assets/js/index.js"></script> <script src="js/jquery.mobile-1.3.1.min.js"></script> <style type="text/css"> .auto-style1 { width: 61px; } .auto-style2 { width: 540px; } .style1 { } </style> </head> <body> <form id="form1" runat="server"> <table style="width: 92%;"> <tr> <td class="auto-style1"> num: </td> <td class="auto-style2"> <asp:textbox id="txt_num" runat="server" type="search"></asp:textbox> <td class="style1"> <asp:button id="btn_search" runat="server" text="search" data-inline="true" data-theme="b" data-icon="search" data-iconpos="left" /> </tr> <tr> <td class="auto-style1"> name: </td> <td class="auto-style2"> <asp:textbox id="txt_name" runat="server" type="text"></asp:textbox> </td> <td> <asp:button id="btn_balance" runat="server" text="get balance" data-inline="true" data-theme="b" data-icon="grid" data-iconpos="left" /> </tr> <tr> <td class="auto-style1"> </td> <td class="auto-style2"> </td> <td> </tr> </table> </form> <div> </div> <!-- table start here --> <div> <% if ispostback , btn_balance.tooltip = "click" dim tb1_header = "<table data-role=""table"" id=""table-custom-2"" data-mode="""" class=""ui-body-d ui-shadow table-stripe ui-responsive""><thead><tr class=""ui-bar-d""><th data-priority=""2"">date</th><th>desc</th><th data-priority=""3"">credit</th><th data-priority=""1""><abbr title=""rotten tomato rating"">debit</abbr></th><th data-priority=""5"" class=""style2"">balance</th></tr></thead>" response.write(tb1_header) dim dt = return_result() response.write("<tbody>") = 0 dt.rows.count - 1 dim tbl_row = "<th>" & dt(i)(0) & "</th><td>" & dt(i)(1) & "</td><td>" & dt(i)(2) & "</td><td>" & dt(i)(3) & "</td><td>" & dt(i)(4) & "</td></tr>" response.write(tbl_row) next response.write("</tbody></table>") end if %> </div> </html>
in aspx.vb side
imports system.data.sqlclient imports system.data imports system.web.script.serialization partial class default2 inherits system.web.ui.page dim conn new sqlconnection function connecttosqlserver(byval server string, byval database string, byval username string, byval password string) ... ... return sql_conn end function protected sub btn_search_click(sender object, e system.eventargs) handles btn_search.click btn_balance.tooltip = "notclick" ... get_the_customer_name , display in txt_name end sub protected sub page_load(sender object, e system.eventargs) handles me.load conn = connecttosqlserver(my_server, my_data, my_uid, my_pwd) end sub protected sub btn_balance_click(sender object, e system.eventargs) handles btn_balance.click btn_balance.tooltip = "click" end sub end class
Comments
Post a Comment