protected void bindGrid(int advisorBranchId, int branchHeadId, int all) { //DataSet ds = new DataSet(); //DataTable BranchAssetsTab = new DataTable(); DataRow drAssets; DataRow drValues; branchDetailsDS = advisorBranchBo.GetBranchAssets(advisorBranchId, branchHeadId, all); topFiveRMDT = branchDetailsDS.Tables[1]; topFiveCustomerDT = branchDetailsDS.Tables[2]; if (branchDetailsDS.Tables[0].Rows.Count > 0) { hrBranchAum.Visible = true; ErrorMessage.Visible = false; lblBranchAUM.Visible = true; branchAumDT.Columns.Add("Asset"); branchAumDT.Columns.Add("CurrentValue"); drValues = branchDetailsDS.Tables[0].Rows[0]; //DataView view = branchAumDT.DefaultView; //view.Sort = "CurrentValue"; for (int i = 0; i < branchDetailsDS.Tables[0].Columns.Count - 1; i++) { drAssets = branchAumDT.NewRow(); drAssets["Asset"] = branchDetailsDS.Tables[0].Columns[i].ColumnName; drAssets["CurrentValue"] = drValues[i].ToString(); branchAumDT.Rows.Add(drAssets); if (GridViewCultureFlag == true) { double tempCurrValue = 0; double.TryParse(drValues[i].ToString(), out tempCurrValue); tempCurrValue = Math.Round(tempCurrValue, 2); drAssets["CurrentValue"] = tempCurrValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); } else { double tempCurrValue = 0; double.TryParse(drValues[i].ToString(), out tempCurrValue); tempCurrValue = Math.Round(tempCurrValue, 2); drAssets["CurrentValue"] = tempCurrValue; } } gvBMDashBoardGrid.DataSource = branchAumDT; //branchAumDT.DefaultView.Sort = "CurrentValue"; gvBMDashBoardGrid.DataBind(); gvBMDashBoardGrid.GridLines = GridLines.Both; Label TotalText = (Label)gvBMDashBoardGrid.FooterRow.FindControl("lblTotalText"); Label TotalValue = (Label)gvBMDashBoardGrid.FooterRow.FindControl("lblTotalValue"); TotalText.Text = branchDetailsDS.Tables[0].Columns[branchDetailsDS.Tables[0].Columns.Count - 1].ColumnName; TotalValue.Text = drValues[branchDetailsDS.Tables[0].Columns.Count - 1].ToString(); if (GridViewCultureFlag == true) { double tempTotalValue = 0; double.TryParse(drValues[branchDetailsDS.Tables[0].Columns.Count - 1].ToString(), out tempTotalValue); tempTotalValue = Math.Round(tempTotalValue, 2); TotalValue.Text = tempTotalValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); } } else { hrBranchAum.Visible = false; ErrorMessage.Visible = true; gvBMDashBoardGrid.DataSource = null; gvBMDashBoardGrid.Visible = false; lblBranchAUM.Visible = false; } /* Top 5 RM Grid */ //DataRow drRMName; //DataRow drRMValue; //if (branchDetailsDS.Tables[0].Rows.Count > 0) //{ // hrTop5Rm.Visible = true; // ErrorMsgForTop5RMs.Visible = false; // lblTop5RM.Visible = true; //topFiveRMDT.Columns.Add("Rm Name"); //topFiveRMDT.Columns.Add("Staff Code"); //topFiveRMDT.Columns.Add("Customer base"); //topFiveRMDT.Columns.Add("Customer networth"); //drRMValue = branchDetailsDS.Tables[1].Rows[0]; //for (int i = 0; i < branchDetailsDS.Tables[1].Columns.Count; i++) //{ // drRMName = topFiveRMDT.NewRow(); // drRMName["RmName"] = branchDetailsDS.Tables[1].Columns[i].ColumnName; // drRMName["Staff_Code"] = branchDetailsDS.Tables[1].Columns[i].ColumnName; // drRMName["Customer_base"] = branchDetailsDS.Tables[1].Columns[i].ColumnName; // drRMName["Customer_networth"] = drRMValue[i].ToString(); // topFiveRMDT.Rows.Add(drRMName); // //if (GridViewCultureFlag == true) // //{ // // decimal tempRMValue = System.Math.Round(decimal.Parse(drRMValue[i].ToString()), 2); // // drRMName["Customer networth"] = tempRMValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); // //} // //else // //{ // // drRMName["Customer networth"] = decimal.Parse(drRMValue[i].ToString()); // //} //} if (topFiveRMDT.Rows.Count > 0) { int i = 0; hrTop5Rm.Visible = true; ErrorMsgForTop5RMs.Visible = false; lblTop5RM.Visible = true; gvRMCustNetworth.Visible = true; for (i = 0; i < topFiveRMDT.Rows.Count - 1; i++) { topFiveRMDT.Rows[i]["Customer_networth"] = topFiveRMDT.Rows[i]["Customer_networth"].ToString(); } //if (GridViewCultureFlag == true) //{ // decimal tempRMValue = System.Math.Round(decimal.Parse(topFiveRMDT.Rows[i]["Customer_networth"].ToString()), 2); // topFiveRMDT.Rows[i]["Customer_networth"] = tempRMValue.ToString("n2", System.Globalization.CultureInfo.CreateSpecificCulture("hi-IN")); //} gvRMCustNetworth.DataSource = topFiveRMDT; gvRMCustNetworth.DataBind(); } else { hrTop5Rm.Visible = false; ErrorMsgForTop5RMs.Visible = true; lblTop5RM.Visible = false; gvRMCustNetworth.DataSource = null; gvRMCustNetworth.Visible = false; } if (topFiveCustomerDT.Rows.Count > 0) { hrTop5Cust.Visible = true; ErrorMsgForTop5Customer.Visible = false; gvCustNetWorth.Visible = true; lblTop5CustNetworth.Visible = true; gvCustNetWorth.DataSource = topFiveCustomerDT; gvCustNetWorth.DataBind(); } else { hrTop5Cust.Visible = false; ErrorMsgForTop5Customer.Visible = true; lblTop5CustNetworth.Visible = false; gvCustNetWorth.DataSource = null; gvCustNetWorth.Visible = false; } }