protected void btnSave_Click(object sender, EventArgs e) { lblEName.Text = ""; lblMessage.Text = ""; int er = 0; if (txtName.Text == "") { er++; lblEName.Text = "Required"; } if (er > 0) { return; } IUBAT13wfa.DAL.Country c = new IUBAT13wfa.DAL.Country(); c.Name = txtName.Text; if (c.Insert()) { lblMessage.ForeColor = System.Drawing.Color.Green; lblMessage.Text = "Country Inserted"; txtName.Text = ""; txtName.Focus(); } else { lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = c.Error; } }
protected void Page_Load(object sender, EventArgs e) { IUBAT13wfa.DAL.Country c = new IUBAT13wfa.DAL.Country(); GridView1.DataSource = c.Select().Tables[0]; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } IUBAT13wfa.DAL.Country ctm = new IUBAT13wfa.DAL.Country(); ddlCity.DataSource = ctm.Select().Tables[0]; ddlCity.DataTextField = "name"; ddlCity.DataValueField = "id"; ddlCity.DataBind(); }