我如何...使用JQuery将数据从数据库绑定到DataGrid? [英] How do I...bind data from database to DataGrid Using JQuery?

查看:204
本文介绍了我如何...使用JQuery将数据从数据库绑定到DataGrid?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将数据绑定到Gridview下:







 <   asp:GridView     id   =  gridUserData    runat   = 服务器   >  
< >
< asp:TemplateField HeaderText = 用户代码 HeaderStyle-Width = 110px SortExpression = USRM_USER_CD >
< ItemTemplate >
< asp:Label ID = lblRepUserCode runat = server 文本 =' <% #Eval( USRM_USER_CD%> ' / >
< / ItemTemplate >
< / asp:TemplateField >
< asp:TemplateField HeaderText = 用户名 SortExpression = < span class =code-keyword> USRM_USER_NAME HeaderStyle-Width = 150px >
< ItemTemplate >
< span class =code-keyword>< asp:Label ID = lblRepUserName runat = server 文字 =' < ;% #Eval( USRM_USER_NAME%> ' / >
< / ItemTemplate >
< / asp:TemplateField >
< /列 >
< / asp:GridView >

解决方案

< blockquote>查看 GridView.DataBind() [ ^ ]方法,它允许您绑定数据,并且您可以通过一个简单的SQL查询将数据库中的动态数据分配给它,该查询将从您的数据库返回记录。


how can bind data to under Gridview :



<asp:GridView id="gridUserData" runat="server" >
    <Columns>
        <asp:TemplateField HeaderText="User Code" HeaderStyle-Width="110px" SortExpression="USRM_USER_CD"  >
            <ItemTemplate>
                <asp:Label ID="lblRepUserCode" runat="server" Text='<%#Eval("USRM_USER_CD")%>' />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="User Name" SortExpression="USRM_USER_NAME" HeaderStyle-Width="150px">
            <ItemTemplate>
                <asp:Label ID="lblRepUserName" runat="server" Text='<%#Eval("USRM_USER_NAME")%>' />
            </ItemTemplate>
        </asp:TemplateField>
  </Columns>
</asp:GridView>

解决方案

Have a look at the GridView.DataBind()[^] method, that would let you bind data, and you can assign a dynamic data from Database to it through a simple SQL Query that would return the records from your database.


这篇关于我如何...使用JQuery将数据从数据库绑定到DataGrid?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆