如何改变datagrid被选中项的底色? 如何改变datagrid被选中项的底色? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 /// <param name="sender"></param> /// <param name="e"></param> private bool btn_CCExchg_Save_Click() { try { ComLogOutput.WriteLogFile("btn_CCExchg_Save_Click Begin"); bool flag = true; //Creat a new datatable DataTable dtUpt = null; if(this.Session["dsp_TripReport_CCExchg"]==null) { BindData_pnlCCExchg(); } //Copy the construct of the dataset DataTable dtOri = (DataTable)this.Session["dsp_TripReport_CCExchg"]; dtUpt= dtOri.Copy(); for(int intDs = 0; intDs < dg_CCExchg.Items.Count;intDs++) { string CurrSell = ((UC_Curr)dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_CurrSell")).GetSelectValue; TextBox AmtSell = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_AmtSell")); UC_Curr CurrBuy = ((UC_Curr)dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_CurrBuy")); TextBox AmtBuy = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_AmtBuy")); TextBox RatioAB = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_RatioAB")); TextBox RatioHKD = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_RatioHKD")); string CompanyRate = ((CheckBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_chk_CompanyRate")).Checked?"T":"F"; TextBox Receipt = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_Receipt")); if(ComStyleCheck.CheckRequired(AmtSell.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(AmtSell.Text.Trim(),6,2)) { AmtSell.BackColor = Color.Red; flag=false; } else { AmtSell.BackColor = Color.White; if(AmtSell.Text.Trim() !="") { dtUpt.Rows[intDs]["AMT_SELL"] = AmtSell.Text.Trim(); } } if(ComStyleCheck.CheckRequired(AmtBuy.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(AmtBuy.Text.Trim(),6,2)) { AmtBuy.BackColor = Color.Red; flag=false; } else { AmtBuy.BackColor = Color.White; if(AmtBuy.Text.Trim() !="") { dtUpt.Rows[intDs]["AMT_BUY"] = AmtBuy.Text.Trim(); } } if(ComStyleCheck.CheckRequired(RatioAB.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(RatioAB.Text.Trim(),2,4)) { RatioAB.BackColor = Color.Red; flag=false; } else { RatioAB.BackColor = Color.FromArgb(217,217,217); if(RatioAB.Text.Trim() !="") { dtUpt.Rows[intDs]["RATIO"] = RatioAB.Text.Trim(); } } if(ComStyleCheck.CheckRequired(RatioHKD.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(RatioHKD.Text.Trim(),2,4)) { RatioHKD.BackColor = Color.Red; flag=false; } else { RatioHKD.BackColor = Color.FromArgb(217,217,217); if(RatioHKD.Text.Trim() !="") { dtUpt.Rows[intDs]["RATIO_BASE"] = RatioHKD.Text.Trim(); } } if(Receipt.Text.Trim().Replace("-","").Length > 5) { Receipt.BackColor = Color.Red; flag = false; } else { Receipt.BackColor = Color.White; dtUpt.Rows[intDs]["ATTACHMENT"] = Receipt.Text.Trim().Replace("-",""); } dtUpt.Rows[intDs]["CURR_SELL"] = CurrSell.Trim(); dtUpt.Rows[intDs]["CURR_BUY"] = CurrBuy.GetSelectValue.Trim(); dtUpt.Rows[intDs]["COMP_RATE"] = CompanyRate; } if(flag == false) { //lbl_Err.Text = "you must input correct info !"; lbl_Err.Text = ComLocalDiff.GetMessageById("1126",UserInfo.LangCode); return false; } // update DB new TripReportDB().UpdateCCExchg(gs_cmpy.Value,is_serial.Value,UserInfo.UID,dtUpt); new TripReportDB().UpdateRe(gs_cmpy.Value,is_serial.Value,UserInfo.UID,"3",txt_CCExchg_Re.Text); BindData_pnlCCExchg(); ComLogOutput.WriteLogFile("btn_CCExchg_Save_Click end"); return true; } catch(Exception ex) { ComLogOutput.WriteLogFile(ex); lbl_Err.Text = ex.Message; return false; } } WinForm 还是 WebForm 的阿??? p2p之UDP打洞,求高手教 【向zgke提问】打印panel控件问题 关于FTP下载文件的问题,急需,在线等! C#水晶报表的使用. VSTO开发Excel自定义公式的问题 如何把对称密钥 或者 非对称密钥添加到上传软件中(c#) .net 下有类似与 vcl 中 TStrings的类吗? C#如何在當前的winform裏面調用另一個winform中的checkedlistbox中的數據 C#读取文件夹里的内容 C#写聊天软件,同步好还是异步好! 一管理系统,对用户公告若干条信息,若用户未阅读过,则旁边显示NEW图标,阅读过就不显示了,请教怎样做法? 如何关闭所有弹出窗口?散分!
/// <param name="e"></param>
private bool btn_CCExchg_Save_Click()
{
try
{
ComLogOutput.WriteLogFile("btn_CCExchg_Save_Click Begin");
bool flag = true;
//Creat a new datatable
DataTable dtUpt = null;
if(this.Session["dsp_TripReport_CCExchg"]==null)
{
BindData_pnlCCExchg();
} //Copy the construct of the dataset
DataTable dtOri = (DataTable)this.Session["dsp_TripReport_CCExchg"];
dtUpt= dtOri.Copy(); for(int intDs = 0; intDs < dg_CCExchg.Items.Count;intDs++)
{
string CurrSell = ((UC_Curr)dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_CurrSell")).GetSelectValue;
TextBox AmtSell = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_AmtSell"));
UC_Curr CurrBuy = ((UC_Curr)dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_CurrBuy"));
TextBox AmtBuy = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_AmtBuy"));
TextBox RatioAB = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_RatioAB"));
TextBox RatioHKD = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_RatioHKD"));
string CompanyRate = ((CheckBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_chk_CompanyRate")).Checked?"T":"F";
TextBox Receipt = ((TextBox)this.dg_CCExchg.Items[intDs].FindControl("dg_CCExchg_txt_Receipt")); if(ComStyleCheck.CheckRequired(AmtSell.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(AmtSell.Text.Trim(),6,2))
{
AmtSell.BackColor = Color.Red;
flag=false;
}
else
{
AmtSell.BackColor = Color.White; if(AmtSell.Text.Trim() !="")
{
dtUpt.Rows[intDs]["AMT_SELL"] = AmtSell.Text.Trim();
}
} if(ComStyleCheck.CheckRequired(AmtBuy.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(AmtBuy.Text.Trim(),6,2))
{
AmtBuy.BackColor = Color.Red;
flag=false;
}
else
{
AmtBuy.BackColor = Color.White; if(AmtBuy.Text.Trim() !="")
{
dtUpt.Rows[intDs]["AMT_BUY"] = AmtBuy.Text.Trim();
}
} if(ComStyleCheck.CheckRequired(RatioAB.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(RatioAB.Text.Trim(),2,4))
{
RatioAB.BackColor = Color.Red;
flag=false;
}
else
{
RatioAB.BackColor = Color.FromArgb(217,217,217); if(RatioAB.Text.Trim() !="")
{
dtUpt.Rows[intDs]["RATIO"] = RatioAB.Text.Trim();
}
} if(ComStyleCheck.CheckRequired(RatioHKD.Text.Trim()) && !ComStyleCheck.CheckMoneyValue(RatioHKD.Text.Trim(),2,4))
{
RatioHKD.BackColor = Color.Red;
flag=false;
}
else
{
RatioHKD.BackColor = Color.FromArgb(217,217,217); if(RatioHKD.Text.Trim() !="")
{
dtUpt.Rows[intDs]["RATIO_BASE"] = RatioHKD.Text.Trim();
}
}
if(Receipt.Text.Trim().Replace("-","").Length > 5)
{
Receipt.BackColor = Color.Red;
flag = false;
}
else
{
Receipt.BackColor = Color.White;
dtUpt.Rows[intDs]["ATTACHMENT"] = Receipt.Text.Trim().Replace("-","");
}
dtUpt.Rows[intDs]["CURR_SELL"] = CurrSell.Trim(); dtUpt.Rows[intDs]["CURR_BUY"] = CurrBuy.GetSelectValue.Trim(); dtUpt.Rows[intDs]["COMP_RATE"] = CompanyRate;
}
if(flag == false)
{
//lbl_Err.Text = "you must input correct info !";
lbl_Err.Text = ComLocalDiff.GetMessageById("1126",UserInfo.LangCode); return false;
}
// update DB
new TripReportDB().UpdateCCExchg(gs_cmpy.Value,is_serial.Value,UserInfo.UID,dtUpt); new TripReportDB().UpdateRe(gs_cmpy.Value,is_serial.Value,UserInfo.UID,"3",txt_CCExchg_Re.Text); BindData_pnlCCExchg(); ComLogOutput.WriteLogFile("btn_CCExchg_Save_Click end");
return true;
}
catch(Exception ex)
{
ComLogOutput.WriteLogFile(ex);
lbl_Err.Text = ex.Message; return false;
}
}