RowDataBound

 protected void gvINF_CrudePrice_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string type = string.Empty;
            string curde_id = string.Empty;
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                type = (e.Row.FindControl("lblCrude_Baseid") as Label).Text;
                switch (type)
                {
                    case "CRUDE_LIGHT":
                        (e.Row.FindControl("lblCrude_Baseid") as Label).Text = "輕質油";
                        break;
                    case "CRUDE_MIDDLE1":
                        (e.Row.FindControl("lblCrude_Baseid") as Label).Text = "中質油1";
                        break;
                    case "CRUDE_MIDDLE2":
                        (e.Row.FindControl("lblCrude_Baseid") as Label).Text = "中質油2";
                        break;
                    case "CRUDE_HEAVE":
                        (e.Row.FindControl("lblCrude_Baseid") as Label).Text = "重質油";
                        break;
                }
                curde_id = (e.Row.FindControl("lblProduct_Name") as Label).Text;
                DataSet ds=logic.select_BaseProduct(curde_id);
                (e.Row.FindControl("lblProduct_Name") as Label).Text = ds.Tables[0].Rows[0]["product_name"].ToString();
               
            }
        }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章