Ejemplo n.º 1
0
 public string GetFieldName(ASPxGridView ASPxGridView1, string fieldID)
 {
     for (int j = 1; j < ASPxGridView1.Columns.Count; j++)
     {
         if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataTextColumn")
         {
             DevExpress.Web.ASPxGridView.GridViewDataTextColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataTextColumn)ASPxGridView1.Columns[j];
             string field = datacolumn.FieldName;
             if (field == fieldID)
             {
                 return(datacolumn.Caption);
             }
         }
         else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataColumn")
         {
             DevExpress.Web.ASPxGridView.GridViewDataColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataColumn)ASPxGridView1.Columns[j];
             string field = datacolumn.FieldName;
             if (field == fieldID)
             {
                 return(datacolumn.Caption);
             }
         }
         else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn")
         {
             DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn)ASPxGridView1.Columns[j];
             string field = datacolumn.FieldName;
             if (field == fieldID)
             {
                 return(datacolumn.Caption);
             }
         }
         else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataDateColumn")
         {
             DevExpress.Web.ASPxGridView.GridViewDataDateColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataDateColumn)ASPxGridView1.Columns[j];
             string field = datacolumn.FieldName;
             if (field == fieldID)
             {
                 return(datacolumn.Caption);
             }
         }
     }
     return("");
 }
Ejemplo n.º 2
0
    public void GetTitle(ASPxGridView ASPxGridView1, string tablename)
    {
        PublicClass pc    = new PublicClass();
        string      ctext = pc.GetLanguageColumn();

        sSQL = "select * from  _TableColInfo where  TABLE_NAME in ('" + tablename + "')";
        DataTable dt = clsSQLCommond.ExecQuery(sSQL);

        for (int j = 0; j < ASPxGridView1.Columns.Count; j++)
        {
            if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataTextColumn")
            {
                DevExpress.Web.ASPxGridView.GridViewDataTextColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataTextColumn)ASPxGridView1.Columns[j];
                string    field = datacolumn.FieldName;
                DataRow[] dw    = dt.Select("COLUMN_NAME='" + field + "'");
                if (dw.Length == 0)
                {
                }
                else if (dw.Length > 0 && dw[0][ctext].ToString() != "")
                {
                    string caption = dw[0][ctext].ToString();
                    datacolumn.Caption = caption;
                    if (dw[0]["VisibleIndex"].ToString() != "")
                    {
                        //datacolumn.VisibleIndex = int.Parse(dw[0]["VisibleIndex"].ToString());
                    }
                }
                else
                {
                    //datacolumn.Visible = false;
                }
            }
            else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataColumn")
            {
                DevExpress.Web.ASPxGridView.GridViewDataColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataColumn)ASPxGridView1.Columns[j];
                string    field = datacolumn.FieldName;
                DataRow[] dw    = dt.Select("COLUMN_NAME='" + field + "'");
                if (dw.Length == 0)
                {
                }
                else if (dw.Length > 0 && dw[0][ctext].ToString() != "")
                {
                    string caption = dw[0][ctext].ToString();
                    datacolumn.Caption = caption;
                    if (dw[0]["VisibleIndex"].ToString() != "")
                    {
                        //datacolumn.VisibleIndex = int.Parse(dw[0]["VisibleIndex"].ToString());
                    }
                }
                else
                {
                    //datacolumn.Visible = false;
                }
            }
            else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataDateColumn")
            {
                DevExpress.Web.ASPxGridView.GridViewDataDateColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataDateColumn)ASPxGridView1.Columns[j];
                string    field = datacolumn.FieldName;
                DataRow[] dw    = dt.Select("COLUMN_NAME='" + field + "'");
                if (dw.Length == 0)
                {
                }
                else if (dw.Length > 0 && dw[0][ctext].ToString() != "")
                {
                    string caption = dw[0][ctext].ToString();
                    datacolumn.Caption = caption;
                    if (dw[0]["VisibleIndex"].ToString() != "")
                    {
                        //datacolumn.VisibleIndex = int.Parse(dw[0]["VisibleIndex"].ToString());
                    }
                }
                else
                {
                    //datacolumn.Visible = false;
                }
            }
            else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn")
            {
                DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn)ASPxGridView1.Columns[j];
                string    field = datacolumn.FieldName;
                DataRow[] dw    = dt.Select("COLUMN_NAME='" + field + "'");
                if (dw.Length == 0)
                {
                }
                else if (dw.Length > 0 && dw[0][ctext].ToString() != "")
                {
                    string caption = dw[0][ctext].ToString();
                    datacolumn.Caption = caption;
                    if (dw[0]["VisibleIndex"].ToString() != "")
                    {
                        //datacolumn.VisibleIndex = int.Parse(dw[0]["VisibleIndex"].ToString());
                    }
                }
                else
                {
                    //datacolumn.Visible = false;
                }
            }
            else if (ASPxGridView1.Columns[j].GetType().UnderlyingSystemType.FullName == "DevExpress.Web.ASPxGridView.GridViewDataSpinEditColumn")
            {
                DevExpress.Web.ASPxGridView.GridViewDataSpinEditColumn datacolumn = (DevExpress.Web.ASPxGridView.GridViewDataSpinEditColumn)ASPxGridView1.Columns[j];
                string    field = datacolumn.FieldName;
                DataRow[] dw    = dt.Select("COLUMN_NAME='" + field + "'");
                if (dw.Length == 0)
                {
                }
                else if (dw.Length > 0 && dw[0][ctext].ToString() != "")
                {
                    string caption = dw[0][ctext].ToString();
                    datacolumn.Caption = caption;
                    if (dw[0]["VisibleIndex"].ToString() != "")
                    {
                        //datacolumn.VisibleIndex = int.Parse(dw[0]["VisibleIndex"].ToString());
                    }
                }
                else
                {
                    //datacolumn.Visible = false;
                }
            }
        }
    }