国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

DataGrid的用法(一)基本用法

2024-07-21 02:23:26
字體:
來源:轉載
供稿:網友
  • 本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
  • 以前工作中曾總結過datagrid的用法,可一直被我扔在一邊,今日無意中又翻出來,于是想將此文放到csdn,與大家共享,并供大家批判。
    此文是datagrid的入門用法,若你datagrid很熟悉了,可以不用看了。

    目錄:
    1、datagrid的基本使用
    2、修改datagrid的head
    3、單擊datagrid,彈出對話框顯示此item的詳細信息
    4、datagrid的分頁顯示
    5、直接在datagrid中進行能夠編輯
    6、如何修改datagrid中內容的顯示
    7、如何在datagrid中新增加一行
    8、如何在datagrid中排序
    9、如何在datagrid中加入checkbox

    datagrid的基本用法:最好的文檔,就是代碼。
    class01.aspx

    <%@ import namespace="system.data" %>
    <%@ import namespace="system.data.oledb" %>

    <script language="c#" runat="server">
    public void page_load()
    {
    string strsql = "";
    string strconnect = "provider=microsoft.jet.oledb.4.0;data source=c://inetpub//wwwroot//datagrid//school.mdb";

    oledbconnection objconnection = new oledbconnection(strconnect);
    objconnection.open();

    oledbcommand objcommand = new oledbcommand();
    objcommand.connection = objconnection;
    objcommand.commandtype = commandtype.text;

    oledbdataadapter sda = new oledbdataadapter();
    sda.selectcommand = objcommand;
    dataset ds = new dataset();

    strsql = "select id, name, chinese, math, english from scoresheet";
    objcommand.commandtext = strsql;
    sda.fill(ds, "scoresheet");

    datagrid1.datasource=ds.tables["scoresheet"].defaultview;
    datagrid1.databind();

    objconnection.close();
    }
    </script>

    <asp:datagrid id="datagrid1" runat="server" >
    </asp:datagrid>

    運行結果:



    實在很簡單吧,為了方便大家,本文的所有代碼及其數據庫,我提供了下載,大家可以放到本地的環境中運行看看,這樣會更直觀一些。
    http://www.chinacurrents.net/adrift/other/datagrid.rar

    第一講就到此了,基本用法就是基本用法,多一句代碼都不寫:)

    敬請關注后面的內容。

    漂零 [email protected]

    發表評論 共有條評論
    用戶名: 密碼:
    驗證碼: 匿名發表
    主站蜘蛛池模板: 鄂温| 开江县| 甘肃省| 遂溪县| 四川省| 承德县| 怀化市| 潮安县| 阿勒泰市| 嘉荫县| 随州市| 美姑县| 张北县| 伊宁县| 成安县| 清新县| 浦东新区| 府谷县| 威海市| 襄汾县| 汤原县| 拜城县| 中江县| 上饶县| 咸丰县| 沭阳县| 托里县| 莱芜市| 疏附县| 东乡| 三江| 马尔康县| 广元市| 灵山县| 宁强县| 沅陵县| 洪雅县| 乌苏市| 康保县| 桂东县| 淳化县|