protected void ibtnView_Click(object sender, ImageClickEventArgs e)
        {
            //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Successfully')", true);

            GridViewRow   gvRow       = (GridViewRow)((ImageButton)sender).NamingContainer;
            Int32         M_Pack_Slno = Convert.ToInt32(gvPackage.DataKeys[gvRow.RowIndex].Value);
            PackageEntity package     = GetPackage(M_Pack_Slno);

            // Now set value to modal popup
            packageidViewpopup.Value  = package.M_Pack_Slno.ToString();
            viewpackagename.Text      = package.M_Pack_Name;
            viewpackageshortname.Text = package.M_Pack_Sname;

            mpePackageViewpopup.Show();
        }
        protected void btnSave_Click1(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                PackageEntity package = new PackageEntity();
                package.M_Pack_Slno  = Convert.ToInt32(packageidEditpopup.Value);
                package.M_Pack_Name  = txtpackagenameEditpopup.Text.Trim();
                package.M_Pack_Sname = txtpackageshortnameEditpopup.Text.Trim();


                if (package.M_Pack_Slno != 0)
                {
                    UpdatePackage(package);
                }

                LoadData();
            }
        }
        public bool AddNewPackage(PackageEntity package)
        {
            String insertQuery = @"INSERT INTO [M_Pack] ([M_Pack_Name],[M_Pack_Sname]) VALUES(@M_Pack_Name, @M_Pack_Sname)";

            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = _ConnStr;
                SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = insertQuery;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.Parameters.AddWithValue("@M_Pack_Name", package.M_Pack_Name);
                cmd.Parameters.AddWithValue("@M_Pack_Sname", package.M_Pack_Sname);
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                cmd.ExecuteNonQuery();

                return(true);
            }
        }
        public bool UpdatePackage(PackageEntity package)
        {
            String updateQuery = @"UPDATE [M_Pack] SET [M_Pack_Name] = @M_Pack_Name ,[M_Pack_Sname] = @M_Pack_Sname Where[M_Pack_Slno] = @M_Pack_Slno";

            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = _ConnStr;
                SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = updateQuery;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.Parameters.AddWithValue("@M_Pack_Slno", package.M_Pack_Slno);
                cmd.Parameters.AddWithValue("@M_Pack_Name", package.M_Pack_Name);
                cmd.Parameters.AddWithValue("@M_Pack_Sname", package.M_Pack_Sname);


                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                cmd.ExecuteNonQuery();

                return(true);
            }
        }