zoukankan      html  css  js  c++  java
  • ASPxGridView1用法2

    父控件中一定要邦定主键,KeyFieldName="sheet_no";

    接下来就是后台邦定代码了,如何邦定我父控件,前面都说过了,接下来,我们看如何邦定子控件,因为子控件在后台调不出来,所以,我再加一个SqlDataSource控件,用它来邦定子控件,这个邦定要动态的去,在展开行事件中写

      private void NewMethod(int i)
        {
    //得到主键值
            object var = this.grid.GetRowValues(i, new string[] { "sheet_no" });
            this.SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataReader;
            this.SqlDataSource1.ConnectionString = "Server=.;DataBase=hjh02;uid=sa;pwd=1";
            this.SqlDataSource1.SelectCommand = string.Format("select * from lsps_bhqd where sheet_no='{0}'", var.ToString());
            this.SqlDataSource1.DataBind();
        }
    //展开行事件

        protected void grid_DetailRowExpandedChanged(object sender, ASPxGridViewDetailRowEventArgs e)
        {
            NewMethod(e.VisibleIndex);
        }

  • 相关阅读:
    ELF静态链接
    linux
    百度图表插件
    秀米(图文编辑)
    Html 助手
    在型原型工具
    AnalyticDB
    H5 (webApi) 接口帮助文档
    H5 拖拽读取文件和文件夹
    mongodb int字段的一个小坑
  • 原文地址:https://www.cnblogs.com/xiaofengfeng/p/2682600.html
Copyright © 2011-2022 走看看