private void DgCostCbs_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex != -1) { e.Item.Attributes["onmouseover"] = "doMouseOver(this);"; e.Item.Attributes["onmouseout"] = "doMouseOut(this);"; try { TextBox textBox = (TextBox)e.Item.Cells[2].FindControl("TxtBudgetMoney"); textBox.Attributes["onblur"] = "checkDecimal(this);"; } catch { } try { DropDownList dropDownList = (DropDownList)e.Item.Cells[3].FindControl("ddlYear"); DropDownList dropDownList2 = (DropDownList)e.Item.Cells[3].FindControl("ddlMonth"); CBSHypotaxisTableInfo cBSHypotaxisTableInfo = (CBSHypotaxisTableInfo)e.Item.DataItem; dropDownList.SelectedValue = cBSHypotaxisTableInfo.BudgetYear; dropDownList2.SelectedValue = cBSHypotaxisTableInfo.BudgetMonth; } catch { } e.Item.Attributes["onclick"] = string.Concat(new string[] { "doClick(this,'", this.DgCostCbs.ClientID, "');ClickRow('", e.Item.ItemIndex.ToString(), "');" }); } }
private ArrayList GetData() { ArrayList arrayList = new ArrayList(); if (this.DgCostCbs.Items.Count > 0) { foreach (DataGridItem dataGridItem in this.DgCostCbs.Items) { CBSHypotaxisTableInfo cBSHypotaxisTableInfo = new CBSHypotaxisTableInfo(); cBSHypotaxisTableInfo.ProjectCode = this.ProjectCode; cBSHypotaxisTableInfo.NodeCode = this.NodeCode; cBSHypotaxisTableInfo.NodeName = this.NodeName; cBSHypotaxisTableInfo.BudgetYear = ((DropDownList)dataGridItem.Cells[3].Controls[1]).SelectedValue; cBSHypotaxisTableInfo.BudgetMonth = ((DropDownList)dataGridItem.Cells[3].Controls[3]).SelectedValue; string value = (((TextBox)dataGridItem.Cells[2].Controls[1]).Text == "") ? "0" : ((TextBox)dataGridItem.Cells[2].Controls[1]).Text.Trim(); try { cBSHypotaxisTableInfo.BudgetMoney = Convert.ToDecimal(value); } catch { } arrayList.Add(cBSHypotaxisTableInfo); } } return(arrayList); }