protected void ddlAllowance_SelectedIndexChanged(object sender, EventArgs e) { if (ddlAllowance.SelectedValue == "-Select-") { txtcode.Focus(); txtcode.Text = string.Empty; txtDescription.Text = string.Empty; BtnSubmit.Visible = true; BtnUpdate.Visible = false; } try { if (ddlAllowance.SelectedValue != "-Select-") { int MainCode = Converter.GetInteger(ddlAllowance.SelectedValue); A2ZALLOWANCEDTO getDTO = (A2ZALLOWANCEDTO.GetInformation(MainCode)); if (getDTO.Code > 0) { txtcode.Text = Converter.GetString(getDTO.Code); txtDescription.Text = Converter.GetString(getDTO.Description); ddlStatus.SelectedValue = Converter.GetString(getDTO.Status); BtnSubmit.Visible = false; BtnUpdate.Visible = true; txtDescription.Focus(); } else { txtcode.Focus(); txtcode.Text = string.Empty; txtDescription.Text = string.Empty; BtnSubmit.Visible = true; BtnUpdate.Visible = false; } } } catch (Exception ex) { throw ex; } }
protected void txtcode_TextChanged(object sender, EventArgs e) { try { if (ddlAllowance.SelectedValue == "-Select-") { txtDescription.Focus(); } if (txtcode.Text != string.Empty) { int MainCode = Converter.GetInteger(txtcode.Text); A2ZALLOWANCEDTO getDTO = (A2ZALLOWANCEDTO.GetInformation(MainCode)); if (getDTO.Code > 0) { txtcode.Text = Converter.GetString(getDTO.Code); txtDescription.Text = Converter.GetString(getDTO.Description); ddlStatus.SelectedValue = Converter.GetString(getDTO.Status); BtnSubmit.Visible = false; BtnUpdate.Visible = true; ddlAllowance.SelectedValue = Converter.GetString(getDTO.Code); txtDescription.Focus(); } else { txtDescription.Text = string.Empty; BtnSubmit.Visible = true; BtnUpdate.Visible = false; txtDescription.Focus(); } } } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "scriptkey", "<script>alert('System Error.txtcode_TextChanged Problem');</script>"); throw ex; } }