Exemplo n.º 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         clsGifts objGifts = new clsGifts();
         objGifts.GiftName   = txtTypeOfGift.Text;
         objGifts.DOB        = Convert.ToDateTime(txtDate.Text);
         objGifts.Name       = txtName.Text;
         objGifts.Profession = txtProfession.Text;
         objGifts.EmailId    = txtEmail.Text;
         objGifts.MobileNo   = txtPhoneNo.Text;
         objGifts.Address    = txtAddress.Text;
         objGifts.ChildCode  = ddlChildren.SelectedItem.Value;
         int i = objGifts.InsertGiftMasterDetails();
         if (i > 0)
         {
             Page.RegisterClientScriptBlock("Child", "<script>alert('Your Gift Accepted,Than Q')</script>");
         }
         else
         {
             lblMsg.Visible = true;
             lblMsg.Text    = "Error Try Again!";
         }
     }
     catch (Exception ex)
     {
         lblMsg.Visible = true;
         lblMsg.Text    = ex.Message;
     }
 }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         clsGifts objGifts = new clsGifts();
         DataSet  ds       = objGifts.GetGiftsDetails();
         if (ds.Tables[0].Rows.Count > 0)
         {
             grvGifts.DataSource = ds.Tables[0];
             grvGifts.DataBind();
         }
     }
 }