Beispiel #1
0
    //Update Testimonial here
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        try
        {
            string customerName, Testimonial, NewsID;
            customerName = txtnewsheadup.Text.Trim();
            Testimonial  = txtnewsup.Text.Trim();
            NewsID       = lblnewsid.Text;
            if (Checks.Empty(customerName) && Checks.Empty(Testimonial))
            {
                lblmsgup.Text = "*Please Fill all Fields!";
            }
            else if (Checks.Empty(customerName))
            {
                lblmsgup.Text = "*Customer name is required!";
            }
            else if (Checks.Empty(Testimonial))
            {
                lblmsgup.Text = "*Testimonial info. is required!";
            }
            else
            {
                TestimonialInfoData data = new TestimonialInfoData();
                data.CustomerName  = customerName;
                data.Testimonial   = Testimonial;
                data.TestimonialId = int.Parse(NewsID);

                int result = new TestimonialInfoAction().UpdateTestimonial(data); //method caling to update news
                if (result > 0)
                {
                    ViewTestimonial();
                    pnlEditTestimonal.Visible = false;
                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Testimonial updated succesfully!');", true);
                }
            }
        }
        catch (Exception ex)
        {
            lblmsgup.Text = ex.Message;
        }
    }