protected void UpdateColor_Click(object sender, EventArgs e) { try { if (txtBxColorName.Text.Trim() == string.Empty) { MdlPopupColorEdit.Show(); lblErrMessageUpdate.Text = "Please enter the color name."; return; } if (txtBxColorCode.Text.Trim() == string.Empty) { MdlPopupColorEdit.Show(); lblErrMessageUpdate.Text = "Please enter the color code."; return; } int id = Convert.ToInt32(hfColor.Value); string colorName = txtBxColorName.Text.Trim(); string colorCode = txtBxColorCode.Text.Trim(); string colorValue = txtBxColorValue.Text.Trim(); if (txtBxColorName.Text != string.Empty && txtBxColorCode.Text != string.Empty) { int updateColor = (new CatalogColorsDAL()).UpdateColor_DAL(id, colorName, colorCode, colorValue); BindColors(); } } catch (Exception ex) { string strErrCode = ERROR_DISPLAY_MESSAGE + "," + (new Error_Log()).LogErrorIntoDB(ex, "UpdateColor_Click"); lblErr.Text = strErrCode; } }
}//End of InsertNewColor_Click method... /* * Click on Color ID to popup edit window. */ protected void DataList_OnItemCommand(object sener, DataListCommandEventArgs e) { try { lblErrMessageUpdate.Text = string.Empty; if (e.CommandName == "PopupColor") { int id = Convert.ToInt32(e.CommandArgument);//"Color_Id" CommandArgument //Get data from database and populate it on the popup window. DataSet editColor = (new CatalogColorsDAL()).GetColorByColorID_DAL(id); hfColor.Value = editColor.Tables[0].Rows[0]["Color_Id"].ToString(); txtBxColorName.Text = editColor.Tables[0].Rows[0]["Color_Name"].ToString(); txtBxColorCode.Text = editColor.Tables[0].Rows[0]["Color_Code"].ToString(); txtBxColorValue.Text = editColor.Tables[0].Rows[0]["Color_Val"].ToString(); MdlPopupColorEdit.Show(); } } catch (Exception ex) { string strErrCode = ERROR_DISPLAY_MESSAGE + "," + (new Error_Log()).LogErrorIntoDB(ex, "DataList_OnItemCommand"); lblErr.Text = strErrCode; } }
protected void CancelUpdate_Click(object sender, EventArgs e) { try { MdlPopupColorEdit.Hide(); lblErrMessageUpdate.Text = string.Empty; } catch (Exception ex) { string strErrCode = ERROR_DISPLAY_MESSAGE + "," + (new Error_Log()).LogErrorIntoDB(ex, "CancelUpdate_Click"); lblErr.Text = strErrCode; } }