private void FillNews(int NewsID)
        {
            DataTable dt = newsController.GetNewsDataByNewsID(NewsID);

            if (dt.Rows.Count > 0)
            {
                ltrlTitle.Text    = dt.Rows[0]["NewsTitle"].ToString();
                ltrlDate.Text     = dt.Rows[0]["CreatedOnDateChange"].ToString();
                ltrlCompDesc.Text = dt.Rows[0]["NewsDesc"].ToString();

                if (!System.IO.File.Exists(Server.MapPath("DesktopModules\\ThSport\\" + dt.Rows[0]["NewsPicture"].ToString())))
                {
                    imgNews.ImageUrl = "~/DesktopModules/ThSport/Images/NewsImages/no_news.png";
                }
                else
                {
                    imgNews.ImageUrl = Page.ResolveUrl("~/DesktopModules/ThSport/" + dt.Rows[0]["NewsPicture"].ToString());
                }
            }

            int prvid = 0;

            prvid = NewsID - 1;
            dt    = newsController.GetNewsDataByNewsID(prvid);

            if (dt.Rows.Count > 0)
            {
                hdPrv.Value    = dt.Rows[0]["NewsId"].ToString();
                litPrv.Text    = dt.Rows[0]["NewsTitle"].ToString();
                lbPrvDate.Text = dt.Rows[0]["CreatedOnDateChange"].ToString();

                lbPrvReadMore.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "mctl=" + "conNewsDetail", "NewsID=" + prvid);
            }
            else
            {
                lbPrvReadMore.Visible = false;
            }

            int NextID = 0;

            NextID = NewsID + 1;
            dt     = newsController.GetNewsDataByNewsID(NextID);

            if (dt.Rows.Count > 0)
            {
                hdNextNewsId.Value = dt.Rows[0]["NewsId"].ToString();
                litNext.Text       = dt.Rows[0]["NewsTitle"].ToString();
                lbNextDate.Text    = dt.Rows[0]["CreatedOnDateChange"].ToString();

                lbNextReadMore.NavigateUrl = Globals.NavigateURL(PortalSettings.ActiveTab.TabID, "", "mctl=" + "conNewsDetail", "NewsID=" + NextID);
            }
            else
            {
                lbNextReadMore.Visible = false;
            }
        }
示例#2
0
        protected void ddlAction_SelectedIndexChanged(object sender, EventArgs e)
        {
            string str = ((Label)((DropDownList)sender).Parent.FindControl("lblddlActionNewsID")).Text;

            string ddlSelectedValue = ((DropDownList)sender).SelectedValue;

            if (ddlSelectedValue == "Edit")
            {
                funClearData();
                FillSport();
                FillCountry();
                FillEvent();
                FillSeason();
                FillCompetition();
                FillClub();
                FillClubOwner();
                FillClubMember();
                FillTeam();
                FillTeamMember();
                FillPlayer();
                FillSponsor();

                int NewsID = 0;
                int.TryParse(str, out NewsID);

                LinkButton btn = sender as LinkButton;

                clsNews           cs  = new clsNews();
                clsNewsController csc = new clsNewsController();

                DataTable dt = new DataTable();

                dt = csc.GetNewsDataByNewsID(NewsID);

                if (dt.Rows.Count > 0)
                {
                    hidRegID.Value = dt.Rows[0]["NewsId"].ToString();

                    ddlSports.SelectedValue      = dt.Rows[0]["SportId"].ToString();
                    ddlSeason.SelectedValue      = dt.Rows[0]["SeasonId"].ToString();
                    ddlCompetition.SelectedValue = dt.Rows[0]["CompetitionId"].ToString();
                    ddlClub.SelectedValue        = dt.Rows[0]["ClubId"].ToString();
                    ddlClubOwner.SelectedValue   = dt.Rows[0]["ClubOwnersId"].ToString();
                    ddlClubMember.SelectedValue  = dt.Rows[0]["ClubMemberId"].ToString();
                    ddlTeam.SelectedValue        = dt.Rows[0]["TeamId"].ToString();
                    ddlTeamMember.SelectedValue  = dt.Rows[0]["TeamMemberId"].ToString();
                    ddlPlayer.SelectedValue      = dt.Rows[0]["PlayerId"].ToString();
                    ddlEvent.SelectedValue       = dt.Rows[0]["EventId"].ToString();
                    ddlSponsor.SelectedValue     = dt.Rows[0]["SponsorId"].ToString();
                    ddlCountry.SelectedValue     = dt.Rows[0]["CountryID"].ToString();

                    ddlNewsPriority.SelectedValue = dt.Rows[0]["NewsLevelId"].ToString();

                    txtNewsTitle.Text = dt.Rows[0]["NewsTitle"].ToString();
                    txtNewsDesc.Text  = dt.Rows[0]["NewsDesc"].ToString();
                    txtNewText.Text   = dt.Rows[0]["NewsText"].ToString();
                    txtNewsDate.Text  = dt.Rows[0]["NewsDate"].ToString();

                    NewsLogoImage.ImageUrl = dt.Rows[0]["NewsPicture"].ToString();
                    string ufname = dt.Rows[0]["NewsPicture"].ToString().Replace(" ", "");
                    NewsLogoFile.ResolveUrl("ufname");

                    txtVideoPath.Text = dt.Rows[0]["NewsVideo"].ToString();

                    HtmlGenericControl contentPanel1 = (HtmlGenericControl)this.FindControl("ifmOtherVideoPath");
                    contentPanel1.Attributes["src"] = "DesktopModules\\ThSportSite\\" + dt.Rows[0]["NewsOtherVideoPath"].ToString();

                    if (dt.Rows[0]["VideoType"].ToString() == "1")
                    {
                        ddlvideotype.SelectedValue = "YouTube";
                        divvideopath.Visible       = true;
                        divOtherVideoPath.Visible  = false;
                        ifmOtherVideoPath.Visible  = false;
                    }
                    else
                    {
                        ddlvideotype.SelectedValue = "Other";
                        divvideopath.Visible       = false;
                        divOtherVideoPath.Visible  = true;
                        ifmOtherVideoPath.Visible  = true;
                    }

                    if (dt.Rows[0]["ActiveFlagId"].ToString() == "1")
                    {
                        ChkIsActive.Checked = true;
                    }
                    else
                    {
                        ChkIsActive.Checked = false;
                    }

                    if (dt.Rows[0]["ShowFlagId"].ToString() == "1")
                    {
                        ChkIsShow.Checked = true;
                    }
                    else
                    {
                        ChkIsShow.Checked = false;
                    }

                    pnlEntryNews.Visible  = true;
                    PnlGridNews.Visible   = false;
                    btnUpdateNews.Visible = true;
                    btnSaveNews.Visible   = false;
                }
            }
            else if (ddlSelectedValue == "Delete")
            {
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "", "javascript:confirm('Are You Sure? Want To Delete.');", true);
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "confirm", "javascript:Confirmation();", true);
                //int competition_Id = 0;
                //int.TryParse(str, out competition_Id);
                //CompRegInfo.DeleteCompetitionReg(competition_Id);
                //FillGridView();
            }
        }