protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            RscmBkuDataContext rscmdc = new RscmBkuDataContext();
            var kelAg = from k in rscmdc.Kel_anggarans
                        join p in rscmdc.ParentId_DataSource_ComboBoxes on k.PARENT_CODE equals p.KA_CODE
                        where (k.IS_KAS == false)
                        select new { KaId = k.KA_ID, KaCode = k.KA_CODE, KaName = k.KA_NAME, Parent = p.KA_NAME, GtCode = k.GT_CODE, Prefix = k.PREFIX, KaLevel=k.KA_LEVEL, Type=k.TYPE, IsDetail=k.IS_DETAIL, IsActive=k.IS_ACTIVE, IsKas=k.IS_KAS };


            KelAnggaranCollection kaColl = new KelAnggaranCollection();
            ParentIdDataSourceComboBoxQuery parentQ = new ParentIdDataSourceComboBoxQuery("a");
            KelAnggaranQuery kaQ = new KelAnggaranQuery("b");
            kaQ.Select(kaQ.KaId.As("KaId"), kaQ.KaCode.As("KaCode"), kaQ.KaName.As("KaName"), parentQ.KaName.As("Parent"), kaQ.GtCode.As("GtCode"), kaQ.Prefix.As("Prefix"), kaQ.KaLevel.As("KaLevel"), kaQ.Type.As("Type"), kaQ.IsDetail.As("IsDetail"), kaQ.IsActive.As("IsActive"), kaQ.IsKas.As("IsKas"));            
            kaQ.InnerJoin(parentQ).On(kaQ.ParentCode == parentQ.KaCode);
            kaColl.Load(kaQ);
            DataTable dtKA = kaQ.LoadDataTable();
            
            foreach (DataRow dr in dtKA.Rows)
            {
                for (int i = 0; i <= Convert.ToInt32(dr["KaLevel"]); i++)
                {
                    if (i != 0)
                    {
                        dr["KaName"] = "&nbsp;&nbsp;&nbsp;&nbsp;" + dr["KaName"];
                        dr.AcceptChanges();
                    }
                }
            }
            //this.RadGrid1.DataSource = kelAg;
            this.RadGrid1.DataSource = dtKA;
        }
Ejemplo n.º 2
0
 public bool Load(ParentIdDataSourceComboBoxQuery query)
 {
     this.query = query;
     base.InitQuery(this.query);
     return(this.Query.Load());
 }