Friday, 27 March 2015

Custum Paging with speaker list and new list

Custum pagging
-------------------------
CREATE TABLE [dbo].[tblLatestNews](
[eventid] [nvarchar](50) NULL,
[NewsId] [int] IDENTITY(10001,1) NOT NULL,
[Title] [nvarchar](250) NULL,
[NewsDate] [date] NULL,
[NewsDescription] [ntext] NULL,
[Status] [nvarchar](50) NULL,
[logo] [nvarchar](max) NULL,
[shortdesc] [nvarchar](500) NULL,
[Createdate] [datetime] NULL,
[Updatedate] [datetime] NULL,
[UrlLink] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
---------------------
CREATE PROCEDURE [dbo].[Getnews] @PageIndex   INT = '',

                                 @PageSize    INT = '',

                                 @ColumnName  VARCHAR(100)='',

                                 @case        VARCHAR(100)='',

                                 @case_value  VARCHAR(100)='',

                                 @RecordCount INT  output,

                                 @logo        NVARCHAR(250)=NULL,

                                 @UrlLink     NVARCHAR(max)=NULL

AS

  BEGIN

      DECLARE @SQLString NVARCHAR(500);



      ----------------- FOR PRODUCT BASED SEARCH------------------------------          

      IF( @case = 'ALL' )

        BEGIN

            SET nocount ON;



            SELECT Row_number()

                     OVER (

                       ORDER BY newsdate DESC )AS RowNumber,

                   *

            INTO   #results_news_1

            FROM   (SELECT title,

                           CONVERT(VARCHAR(12), newsdate, 106) NewsDate,

                           newsid,

                           newsdescription,

                           shortdesc,

                           logo,

                           urllink

                    FROM   tbllatestnews

                    WHERE  eventid = 'event475'

                           AND status = 'Show') AS t



            SELECT @RecordCount = Count(newsid)

            FROM   #results_news_1



            SELECT *

            FROM   #results_news_1

            WHERE  rownumber BETWEEN( @PageIndex - 1 ) * @PageSize + 1 AND( (

                                    ( @PageIndex - 1 ) * @PageSize + 1 ) +

                                         @PageSize ) - 1

            ORDER  BY newsdate DESC



            DROP TABLE #results_news_1

        END



      IF( @case = 'SEARCH' )

        BEGIN

            SET nocount ON;



            SELECT Row_number()

                     OVER (

                       ORDER BY CONVERT(VARCHAR(12), newsdate, 103) )AS

                   RowNumber,

                   *

            INTO   #results_news_2

            FROM   (SELECT title,

                           CONVERT(VARCHAR(12), newsdate, 106) NewsDate,

                           newsid,

                           newsdescription,

                           shortdesc,

                           logo,

                           urllink

                    FROM   tbllatestnews

                    WHERE  eventid = 'event475'

                           AND ( title LIKE '%' + @case_value + '%' )

                           AND status = 'Show') AS t



            SELECT @RecordCount = Count(newsid)

            FROM   #results_news_2



            SELECT *

            FROM   #results_news_2

            WHERE  rownumber BETWEEN( @PageIndex - 1 ) * @PageSize + 1 AND( (

                                    ( @PageIndex - 1 ) * @PageSize + 1 ) +

                                         @PageSize ) - 1

            ORDER  BY rownumber



            DROP TABLE #results_news_2

        END

  END
--------------------------
<%@ Page Language="C#" MasterPageFile="OuterMasterPage.master" AutoEventWireup="true"
    CodeFile="News.aspx.cs" Inherits="News" Title="Daily News" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<Style>
    .newbox
    {
        padding:10px 0;
        margin:0 0 10px 0;
        border-bottom:1px solid #cccccc;
    }
.newsdate
{
    margin:0px;
    padding:0px;
    color:#A0A0A0;
    font-size:14px;
}
.newstitle
{
    font-family:ProximaNovaRegular;
   
}
.newstitle a
{
    color:#3e3e3e;
    text-decoration:none;
    font-size:24px;
}
.newstitle a:hover
{
    color:#018d82;
    text-decoration:none;
}
.newsdescription
{
    padding:10px 0 0 0;
}
.newsimage
{
    margin:0 0 10px 10px;
    float:right;
    width:300px!important;
}
</Style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContents" runat="Server">

 
    <div class="counting">
        <asp:Repeater ID="Repeater1" runat="server">
            <ItemTemplate>
                <asp:LinkButton ID="lnkPage2" runat="server" Text='<%#Eval("Text") %>' CommandArgument='<%# Eval("Value") %>'
                    Enabled='<%# Eval("Enabled") %>' OnClick="Page_Changed"></asp:LinkButton>
            </ItemTemplate>
        </asp:Repeater>
    </div>
    <div class="clear">
    </div>
   
    <div class="text">
        <asp:Repeater ID="GridView1" runat="server">
            <HeaderTemplate>
            </HeaderTemplate>
            <ItemTemplate>
            <div class="newbox">
            <%#(!String.IsNullOrEmpty(Eval("logo").ToString()) ? "<img class='newsimage' src="+ Eval("logo").ToString() + ">" : " ")%>
           <%-- <img src="uploads/news.jpg" class="newsimage" />--%>
                <span class="newsdate">
                    <%# Eval("NewsDate")%></span>
                <div class="newstitle">          
               <%#(!String.IsNullOrEmpty(Eval("UrlLink").ToString()) ? "<a target='_blank' href=" + Eval("UrlLink").ToString() + "> " + Eval("Title").ToString() + "</a>" : "<a href='NewsDetailsPage.aspx?NewsId=" + Eval("NewsId").ToString() + "&id=news'>" + Eval("Title").ToString() + "</a>")%>

                  <%--<a href='NewsDetailsPage.aspx?NewsId=<%# Eval("NewsId")%>&id=news'>
                        <%# Eval("Title")%></a></div>
--%>
                       
              </div>
             
                <div class="newsdescription">
                    <%# Eval("shortdesc")%>
                    &nbsp;&nbsp;
                   
                    <%#(!String.IsNullOrEmpty(Eval("UrlLink").ToString()) ? "<a target='_blank' href=" + Eval("UrlLink").ToString() + "> ...read more</a>" : "<a href='NewsDetailsPage.aspx?NewsId=" + Eval("NewsId").ToString() + "&id=news'>...read more</a>")%>
                   
                    </div>
                        <div class="clr"></div>
                        </div>
            </ItemTemplate>
            <FooterTemplate>
            </FooterTemplate>
        </asp:Repeater>
    </div>
   
</asp:Content>
-----------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Services;
using System.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Xml.Linq;
using System.Net.Mail;
using System.Text;


public partial class News : System.Web.UI.Page
{
    string constring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    string exid = string.Empty;
    string display = string.Empty;
    string Stringcase = string.Empty;
    string Stringcase_value = string.Empty;
    string query = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        Security vvv = new Security();
        vvv.CheckStatus();
        Session["eventid"] = "event475";
        Stringcase = "ALL";
        if (!IsPostBack)
        {
            this.GetCustomersPageWise(1);
        }
     

       
    }
 
    private void GetCustomersPageWise(int pageIndex)
    {
        if (pageIndex == 0)
        {
            pageIndex = 1;

        }
        //Response.Write(Stringcase);
        //Response.End();
        string stringColumnName = "";
        DataView dv = new DataView();
        DataTable dt = new DataTable("table");
        using (SqlConnection con = new SqlConnection(constring))
        {
            using (SqlCommand cmd = new SqlCommand("GetNews", con))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ColumnName", stringColumnName);
                cmd.Parameters.AddWithValue("@PageIndex",Convert.ToInt32(pageIndex));
                cmd.Parameters.AddWithValue("@PageSize", int.Parse("8"));
                cmd.Parameters.AddWithValue("@case", Stringcase);
                cmd.Parameters.AddWithValue("@case_value", Stringcase_value);
                cmd.Parameters.Add("@RecordCount", SqlDbType.Int, 4);
                cmd.Parameters["@RecordCount"].Direction = ParameterDirection.Output;
                con.Open();
                SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                dt.Load(dr);
                dv.Table = dt;
                GridView1.DataSource = dv;
                GridView1.DataBind();
                dv.Dispose();
                con.Close();
                int recordCount = Convert.ToInt32(cmd.Parameters["@RecordCount"].Value);
                //Response.Write(recordCount);
               // Response.End();
                this.PopulatePager(recordCount, pageIndex);    
             
            }
        }
    }
    protected void Page_Changed(object sender, EventArgs e)
    {
        //try
        //{
            int pageIndex = int.Parse((sender as LinkButton).CommandArgument);
            this.GetCustomersPageWise(pageIndex);
            //GridView1.DataBind();
         
        //}
        //catch
        //{
        //}
    }
    private void PopulatePager(int recordCount, int currentPage)
    {
        try
        {
            double dblPageCount = (double)((decimal)recordCount / decimal.Parse("8"));
            int pageCount = (int)Math.Ceiling(dblPageCount);
            List<ListItem> pages = new List<ListItem>();
            if (pageCount > 1)
            {
                pages.Add(new ListItem("<b>< First</b>", "1", currentPage > 1));
                for (int i = 1; i <= pageCount; i++)
                {

                    if (i == currentPage)
                    {
                        pages.Add(new ListItem("<b><font size=4 color='#676667'>" + i.ToString() + "</font></b>", i.ToString(), i == currentPage));
                       
                       
                    }
                    else
                    {
                        pages.Add(new ListItem(i.ToString(), i.ToString(), i != currentPage));
                     
                    }
                 
                }
                pages.Add(new ListItem("<b>Last ></b>", pageCount.ToString(), currentPage < pageCount));

                Repeater1.Visible = true;
            }
            else
            {
                Repeater1.Visible = false;
            }
            Repeater1.DataSource = pages;
            Repeater1.DataBind();
        }
        catch
        {
        }
    }
}
----------------------------------
<%@ Page Language="C#" MasterPageFile="OuterMasterPage.master" AutoEventWireup="true"
    CodeFile="NewsDetailsPage.aspx.cs" Inherits="NewsDetailsPage" Title="News Details" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        .newsdescription
        {
            padding: 10px 0 0 0;
        }
        .newsimage
        {
            margin: 0 0 10px 10px;
            float: right;
            width: 300px;
        }
        .goback
        {
            text-align: right;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContents" runat="Server">
    <h1>
        <asp:Literal ID="lititle" runat="server"></asp:Literal>
    </h1>
    <div class="newsdescription">
        <img src="uploads/news.jpg" class="newsimage" />
        <asp:Literal ID="litdescription" runat="server"></asp:Literal></div>
    <div class="goback">
        <a href="javascript:history.go(-1)" class="readnore"> Go Back  </a>
    </div>
</asp:Content>
-------------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class NewsDetailsPage : System.Web.UI.Page
{

    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

    protected void Page_Load(object sender, EventArgs e)
    {
        Security Sec = new Security();
        Sec.CheckStatus();
        Session["eventid"] = "event475";
        if (!IsPostBack)
        {
            bindnewdetails();
        }
    }
    private void bindnewdetails()
    {
        SqlCommand cmd = new SqlCommand("uspNEWS", conn);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@Mode","SELLNEWS");
        cmd.Parameters.AddWithValue("@eventid", Session["eventid"]);
        cmd.Parameters.AddWithValue("@NewsId", Request.QueryString["NewsId"].ToString());
       SqlDataAdapter ada=new SqlDataAdapter(cmd);
        DataTable dt=new DataTable();
        ada.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            lititle.Text = dt.Rows[0]["Title"].ToString();
            litdescription.Text = dt.Rows[0]["NewsDescription"].ToString();
        }
       
    }
}
-----------------------------




CREATE proc [dbo].[uspNEWS]



@Mode nvarchar(200),



@eventid nvarchar(50)=null,



@NewsId  int=null,



@Title nvarchar(250)=null,



@Newsdate date=null,



@Shortdesc nvarchar(500)=null,



@Description nvarchar(max)=null,



@Status  nvarchar(50)=null,

 

@logo nvarchar(250)=null,



@UrlLink nvarchar(max)=null



As



Begin



If(@Mode='INSNEWS')



Begin



INSERT INTO tblLatestNews



        (eventid,Title,NewsDate, NewsDescription,Status,logo,shortdesc,Createdate,UrlLink)



VALUES  (@eventid,@Title,@Newsdate,@Description,@Status,@logo,@Shortdesc,GETDATE(),@UrlLink)



End



If(@Mode='UDPNEWS')



Begin



UPDATE    tblLatestNews



SET Title = @Title, NewsDate = @Newsdate, NewsDescription = @Description,  



  Status=@Status,logo=@logo,shortdesc = @Shortdesc,Updatedate=GETDATE(),UrlLink=@UrlLink



Where eventid=@eventid and NewsId=@NewsId



End



If(@Mode='SELLNEWS')



Begin



select Title,CONVERT(VARCHAR(20),NewsDate,103) NewsDate,CONVERT(VARCHAR(20),NewsDate,106) NewsDate1,NewsDescription,NewsId,shortdesc,Status,logo,UrlLink from tblLatestNews



Where eventid=@eventid and NewsId=@NewsId



End



If(@Mode='SELALLNEWS')



Begin



select Title,CONVERT(VARCHAR(20),NewsDate,106) NewsDate,NewsDescription,NewsId,shortdesc,Status,logo,UrlLink from tblLatestNews



Where eventid=@eventid  



Order By NewsId



End



If(@Mode='SELALLNEWSFRNT')



Begin



select Title,CONVERT(VARCHAR(20),NewsDate,106) NewsDate,NewsDescription,NewsId,shortdesc,Status,logo,UrlLink from tblLatestNews



Where eventid=@eventid and Status='Show'



 



End



End
---------------------------
New Speaker list
<%@ Page Language="C#" MasterPageFile="OuterMasterPagespeaker.master" AutoEventWireup="true"
    CodeFile="SpeakerList.aspx.cs" Inherits="SpeakerList" Title="Resource - Event 2015" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link rel="stylesheet" type="text/css" href="css/plugins.css">
    <style>
        .imagename
        {
            position: relative;
            margin: 0 10px 10px 0;
            padding: 0px;
            width: 175px;
            height: 175px;
            overflow: hidden;
            cursor: pointer;
        }
        img.grayscale
        {
            filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
            filter: gray; /* IE6-9 */
            -webkit-filter: grayscale(100%); /* Chrome 19+, Safari 6+, Safari 6+ iOS */ /*-webkit-filter: grayscale(1);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: gray; filter: grayscale(100%);
filter: url(desaturate.svg#greyscale);*/
        }
        .imageinfo
        {
            display: none;
        }
        .imageinfo .name
        {
            color: #fff;
            font-size: 15px;
            font-weight: bold;
        }
        .imageinfo .imagedesignation
        {
            font-size: 13px;
            color: #fff;
        }
        .imagename:hover .imageinfo
        {
            display: block;
            position: absolute;
            top: 0;
            left: 0;
            width: 150px;
            height: 155px;
            padding: 20px 5px 0 20px;
            text-align: left;
            background: url(imageinfo.png);
        }
        .imagename:hover .imagename img
        {
            opacity: 0.5;
        }
        .exhibitexhi
        {
            background: #fff;
            width: 100%;
            margin: 15px 0 0 0;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContents" runat="Server">
    <div class="exhibitexhi">
        <h2>
            CONFERENCE SPEAKERS</h2>
        <div id="speakerquery" runat="server" visible="false">
            <div class="og-expander-inner" style="padding: 10px 0 20px 0;">
                <span style="top: 17px; position: absolute; right: 20px; z-index: 99;">
                    <asp:ImageButton ID="btnclose" runat="server" OnClick="btnclose_Click" ImageUrl="images/close_top_speaker.png" />
                </span>
                <div class="og-fullimg">
                    <div class="og-loading" style="display: none;">
                    </div>
                    <asp:Label ID="lblid" runat="server"></asp:Label>
                </div>
                <div class="og-details">
                    <h3>
                        <asp:Label ID="lblname" runat="server"></asp:Label></h3>
                    <p>
                        <asp:Label ID="lbljob" runat="server"></asp:Label><br>
                        <b>
                            <asp:Label ID="lblcompany" runat="server" Font-Bold="true"></asp:Label></b><br>
                        <p class="p1">
                            <asp:Label ID="lbldes" runat="server"></asp:Label></p>
                </div>
            </div>
        </div>
        <div style="background: #465761; padding: 5px; color: #fff; line-height: 20px; padding-left: 15px;
            margin-top: 5px;">
            BROWSE THE SPEAKERS BELOW AND CLICK ON IMAGE TO EXPAND. PREFER A LIST VIEW? <a href="speakerlistview2.aspx">
                CLICK HERE</a></div>
        <div class="clr">
        </div>
        <div id="scrollslider" runat="server">
        </div>
    </div>
</asp:Content>
----------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Text;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;

public partial class SpeakerList : System.Web.UI.Page
{

    SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    StringBuilder sb = new StringBuilder();

    protected void Page_Load(object sender, EventArgs e)
    {

        Security vvv = new Security();
        vvv.CheckStatus();
        Session["eventid"] = "event476";
        if (!IsPostBack)
        {
            // binddetails();
            BindGrid();
            BindGridbyspeaker();

        }
    }

    private void BindGrid()
    {
        SqlDataAdapter objadp = new SqlDataAdapter("select * from tbl_learn_livespeaker where eventid='" + Convert.ToString(Session["Eventid"]) + "' and spkr_status='Valid' order by Name", Conn);
        DataTable dt = new DataTable();
        objadp.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            scrollslider.InnerHtml += "<ul id='og-grid' class='og-grid'>";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["logo_image"].ToString() != "")
                {
                    scrollslider.InnerHtml += "<li><a name='" + dt.Rows[i]["spkregid"].ToString() + "' href='javascript:void(0)' style='color:red' data-largesrc='imgupload/" + dt.Rows[i]["logo_image"].ToString() + "' data-title='" + dt.Rows[i]["Name"].ToString().Replace("'", "&rsquo;") + "' data-description='" + dt.Rows[i]["job"].ToString().Replace("'", "&rsquo;") + "<br/><b>" + dt.Rows[i]["company"].ToString().Replace("'", "&rsquo;") + "</b><br />" + dt.Rows[i]["detail"].ToString().Replace("'", "&rsquo;") + "'><img src='imgupload/" + dt.Rows[i]["logo_image"].ToString() + "'  class='grayscale' width='175px' height='175px' > <span class='plus_icon'><b>" + dt.Rows[i]["Name"].ToString().Replace("'", "&rsquo;") + "</b></br>" + dt.Rows[i]["job"].ToString() + "<br><b>" + dt.Rows[i]["company"].ToString().Replace("'", "&rsquo;") + "</b></span></a></li>";

                }
                else
                {
                    scrollslider.InnerHtml += "<li><a name='" + dt.Rows[i]["spkregid"].ToString() + "' href='javascript:void(0)' style='color:red' data-largesrc='imgupload/blank_image.png' data-title='" + dt.Rows[i]["Name"].ToString().Replace("'", "&rsquo;") + "' data-description='" + dt.Rows[i]["job"].ToString().Replace("'", "&rsquo;") + "<br/><b>" + dt.Rows[i]["company"].ToString().Replace("'", "&rsquo;") + "</b><br />" + dt.Rows[i]["detail"].ToString().Replace("'", "&rsquo;") + "'><img src='imgupload/blank_persone.jpg' width='175px' class='grayscale' height='175px' > <span class='plus_icon'><b>" + dt.Rows[i]["Name"].ToString().Replace("'", "&rsquo;") + "</b></br>" + dt.Rows[i]["job"].ToString().Replace("'", "&rsquo;") + "<br><b>" + dt.Rows[i]["company"].ToString().Replace("'", "&rsquo;") + "</b></span></a></li>";

                }

            }
            scrollslider.InnerHtml += "</ul>";



            scrollslider.InnerHtml += "<script src='js/grid.js'></script>";
            scrollslider.InnerHtml += "<script> $(function () { Grid.init(); });</script>";
        }
    }

    private void BindGridbyspeaker()
    {
        SqlDataAdapter objadp = new SqlDataAdapter("select * from tbl_learn_livespeaker where eventid='" + Convert.ToString(Session["Eventid"]) + "' and spkr_status='Valid' and spkregid='" + Request.QueryString["id"] + "'  order by Name", Conn);
        DataTable dt = new DataTable();
        objadp.Fill(dt);
        if (dt.Rows.Count > 0)
        {
            speakerquery.Visible = true;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (dt.Rows[i]["logo_image"].ToString() != "")
                {
                    lblid.Text = "<img src='imgupload/" + dt.Rows[i]["logo_image"].ToString() + "'  class='grayscale' width='175px' height='175px'  style='display: inline;'>";
                }
                else
                {
                    lblid.Text = "<img src='uploads/blank_image.png'  class='grayscale'  style='display: inline;'>";

                }
                lblname.Text = dt.Rows[i]["Name"].ToString().Replace("'", "&rsquo;");
                lbljob.Text = dt.Rows[i]["job"].ToString().Replace("'", "&rsquo;");
                lblcompany.Text = dt.Rows[i]["company"].ToString().Replace("'", "&rsquo;");
                lbldes.Text = dt.Rows[i]["detail"].ToString().Replace("'", "&rsquo;");
            }
        }
        else
        {
            speakerquery.Visible = false;
        }
    }
    protected void btnclose_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("SpeakerList.aspx");
    }

}
--------------------------

CREATE TABLE [dbo].[tbl_learn_livespeaker](
[eventid] [nvarchar](50) NULL,
[spkregid] [nvarchar](max) NULL,
[entrydate] [datetime] NULL,
[Name] [nvarchar](max) NULL,
[Job] [nvarchar](max) NULL,
[Company] [nvarchar](max) NULL,
[Email] [nvarchar](max) NULL,
[Detail] [nvarchar](max) NULL,
[logo_image] [nvarchar](max) NULL,
[Path] [nvarchar](max) NULL,
[Auto_id] [int] IDENTITY(1,1) NOT NULL,
[spkr_status] [nvarchar](500) NULL,
[show_spkaer] [nvarchar](20) NULL,
[spkr_biography] [nvarchar](max) NULL,
[twitter] [nvarchar](max) NULL,
[facebook] [nvarchar](max) NULL,
[linkedin] [nvarchar](max) NULL,
[spkr_vedio] [nvarchar](max) NULL,
[speakertype] [nvarchar](max) NULL,
[Sequenceno] [nvarchar](100) NULL,
[HomeStatus] [nvarchar](50) NULL,
[pic_image] [nvarchar](max) NULL,
[Path1] [nvarchar](max) NULL,
[Twitterlink] [nvarchar](max) NULL,
[Linkedinlink] [nvarchar](max) NULL,
[Facebooklink] [nvarchar](max) NULL,
[Googlelink] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
----------------------
news list new
<%@ Page Language="C#" MasterPageFile="OuterMasterPage.master" AutoEventWireup="true"
    CodeFile="News.aspx.cs" Inherits="News" Title="Daily News" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript" src="js/paging.js"></script>
    <style>
    .pg-normal
    {
        cursor:pointer;
    }
    .pg-selected
    {
        font-weight:bold;
    }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContents" runat="Server">
    <div class="exhibit1">
        <h2 style="float:left;">
            News</h2>
             <div id="pageNavPosition" style="float:right; margin:15px 25px 0 0; font-size:15px;">
        </div>
        <div class="clr"></div>
        <asp:Label ID="lblDetails" runat="server"></asp:Label>
     
        <script type="text/javascript"><!--
            var pager = new Pager('results', 8);
            pager.init();
            pager.showPageNav('pager', 'pageNavPosition');
            pager.showPage(1);
    //--></script>
    <br />
    </div>
    <!-- Start ominature code -->
    <script language="JavaScript" type="text/javascript" src="http://www.resource-event.com/s_code.js"></script>
    <%--Code for home page--%>
    <script language="JavaScript" type="text/javascript"><!--
        /* You may give each page an identifying name, server, and channel on
        the next lines. */

        // These are variables that are to be captured on all pages

        s.pageName = this.document.title; // Pagename based on title tag
        s.pageURL = this.location.href;
        s.pageType = "";
        s.channel = "News"; // Typically based on top navigation level, registration, exhibitor zone, speaker list
        s.prop1 = "" // Site Section or top level navigation item
        s.prop2 = "" // Second level navigation item
        s.prop17 = "Anonymous" // User segment, anonymous, registered, etc
        s.prop22 = "" // Pulled from 'Organisation' in registration
        s.prop23 = "" // Pulled from 'Why interested in attending...' in registration
        s.prop25 = "" // Pulled from 'You are interested to' in registration

        /* Conversion Variables */
        s.campaign = ""
        s.state = ""
        s.zip = ""
        s.events = ""
        s.products = ""
        s.purchaseID = ""
        s.eVar16 = ""   // UserID is taken from username once logged in
        s.eVar17 = ""   // Form name, eg. 'Registration Form'
        s.eVar18 = ""   // Social media click, see SDR doc
        s.eVar26 = "Content"   // Content type, blog, exhibitor listing, speaker listing
        s.eVar27 = "News"   // Content title, headline of article or blog
        s.eVar31 = ""   // Calendar event, with onClick to Add to Outlook
        s.eVar32 = ""   // Document name, with onClick to exhibitor document
        s.eVar33 = ""   // Exhibitor ID, when on exhibitor page
        s.eVar34 = ""   // Email enquiry, onClick of email enquiry link
        s.eVar35 = ""   // Send to mobile, on send to mobile request

        s.prop19 = "Resource Event 2015 website"
        s.eVar49 = "Resource Event 2015 website"

        /************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
        var s_code = s.t(); if (s_code) document.write(s_code)//--></script>
    <!-- End ominature code -->
</asp:Content>
---------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.Services;
using System.Linq;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Xml.Linq;
using System.Net.Mail;
using System.Text;


public partial class News : System.Web.UI.Page
{
    string constring = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    string exid = string.Empty;
    string display = string.Empty;
    string Stringcase = string.Empty;
    string Stringcase_value = string.Empty;
    string query = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        Security vvv = new Security();
        vvv.CheckStatus();
        Session["eventid"] = "event476";
        if (!IsPostBack)
        {
            Binddata();
        }

    }

    private void Binddata()
    {
        conn.Open();
        SqlCommand objcom = new SqlCommand("select pressid,title,CONVERT(varchar(30),pressdate,103) as dat,shortdesc from tblLatestNews where eventid='" + Convert.ToString(Session["eventID"]) + "' and pressstatus='Valid' order by CONVERT(datetime,pressdate,103) desc", conn);
        SqlDataReader dr = objcom.ExecuteReader();
        if (dr.HasRows)
        {
            lblDetails.Text = "";
            lblDetails.Text += "<table id='results'><tr><th></th></tr>";
            while (dr.Read())
            {
                lblDetails.Text += "<tr><td><table>" +
                                "<tr><td><a href='newsdetailspage.aspx?newsid=" + dr["pressid"] + "' style='color:#2c83c7;'><b>" + dr["title"] + "</b></a>&nbsp;&nbsp;" + dr["dat"] + "</td></tr>"
                                + "<tr><td>" + dr["shortdesc"] + " <a href='newsdetailspage.aspx?newsid=" + dr["pressid"] + "'>Read More...</a><br/><hr/></td></tr></table></td></tr>";
            }
            lblDetails.Text += "</table>";
        }
        else
        {
            lblDetails.Text += "coming soon..";
        }
        conn.Close();
    }

}
--------------------------
<%@ Page Language="C#" MasterPageFile="~/OuterMasterPage.master" AutoEventWireup="true"
    CodeFile="NewsDetails.aspx.cs" Inherits="NewsDetails" Title="News Details" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        .section29
        {
            width: 100%;
            float: left;
            background: #ffffff;
            border-bottom: solid 1px #d3d3d3;
            padding-bottom: 60px;
        }
       
        .section29
        {
            width: 100%;
            float: left;
            background: #ffffff;
        }
       
        .section29-main
        {
            width: 98%;
            margin: 0 auto;
        }
       
        .section29-common
        {
            width: 100%;
            float: left;
            padding-top: 20px;
        }
       
        .section29-left
        {
            float: left;
            width: 81px;
            border: solid 1px #0083c8;
            border-radius: 5px;
            margin-right: 20px;
        }
       
        .section29-left-text1
        {
            font-size: 16px;
            color: #47555e;
            width: 100%;
            text-align: center;
            line-height: 25px;
            margin-top: 3px;
        }
       
        .section29-left-text2
        {
            font-size: 35px;
            color: #47555e;
            width: 100%;
            text-align: center;
        }
       
        .section29-left-text3
        {
            font-size: 16px;
            color: #47555e;
            width: 100%;
            text-align: center;
            line-height: 25px;
            margin-bottom: 8px;
        }
       
        .section29-right
        {
            width: 88%;
            float: left;
        }
       
        .section29-right-title
        {
            width: 100%;
            float: left;
            font-size: 24px;
            color: #000000;
            margin-bottom: 15px;
        }
        .section29-right-title a
        {
            color: #0083c8;
        }
       
        .section29-right-content
        {
            width: 100%;
            float: left;
            font-size: 14px;
            color: #606060;
            line-height: 20px;
            margin-bottom: 15px;
        }
       
        .section29-right-content span
        {
            font-size: 14px;
            color: #000000;
        }
       
        .section29-social_like
        {
            width: 100%;
            float: left;
            font-size: 24px;
            color: #000000;
            margin-bottom: 10px;
        }
       
        .section29-social_like ul
        {
            padding: 0px;
            margin: 0px;
            list-style: none;
        }
       
        .section29-social_like ul li
        {
            margin-right: 15px;
            float: left;
            height: auto !important;
        }
       
        .section29-right-more
        {
            background: #2c83c7;
            float: left;
            font-size: 16px;
            color: #ffffff;
            padding: 8px 15px;
        }
       
        .section29-right-more a
        {
            color: #ffffff;
            text-decoration: none;
        }
       
        .section29-right-more a:hover
        {
            color: #ffffff;
            text-decoration: none;
            background: #1c6093;
        }
       
       
        .section29-cnt2
        {
            border-bottom: 1px solid #1c6093;
            border-top: 1px solid #1c6093;
            color: #1c6093;
            float: left;
            font-size: 20px;
            margin-bottom: 25px;
            padding: 10px 0;
            text-align: center;
            width: 100%;
            margin-top: 20px;
        }
       
       
        .section29-form
        {
            width: 55%;
            margin: 0 auto;
        }
       
        .section29-form-area
        {
            width: 100%;
            float: left;
            margin-bottom: 10px;
        }
        .section29-form-area ul
        {
            padding: 0px;
            margin: 0px;
            list-style: none;
        }
        .section29-form-area ul li
        {
            font-size: 14px;
            color: #000000;
            width: 100%;
            margin-bottom: 20px;
            float: left;
        }
        .section29-form-area ul li.title1
        {
            font-size: 14px;
            color: #353535;
            text-align: center;
        }
        .section29-form-area ul li.title1 span
        {
            font-size: 14px;
            color: #0082ca;
        }
       
        .section29-form-area ul li .title-commom
        {
            float: left;
            width: 28%;
            margin-right: 40px;
            padding-top: 8px;
        }
        .section29-form-area ul li .title2
        {
            float: left;
            width: 100%;
            margin-right: 40px;
            line-height: 20px;
        }
        .section29-form-area ul li .title2 span
        {
            font-size: 14px;
            color: #f15f3b;
        }
        .section29-form-area ul li .title2 span.semicilen
        {
            font-size: 16px;
            color: #000000;
            float: right;
        }
        .section29-form-area ul li .limit
        {
            font-size: 12px;
            color: #797979;
            font-style: italic;
        }
       
        .section29-form-area ul li .inputsec
        {
            float: left;
            width: 62%;
        }
        .section29-form-area ul li .input-box
        {
            width: 95%;
            float: left;
            background-color: #DADFE2;
            border: solid 1px #74b5dc;
            padding: 9px;
            border-radius: 8px;
        }
       
        .section29-form-area ul li .textarea
        {
            width: 95%;
            float: left;
            background-color: #DADFE2;
            border: solid 1px #74b5dc;
            padding: 9px;
            border-radius: 8px;
            height: 80px;
            font-family: Arial, Helvetica, sans-serif;
            font-size: 13px;
        }
       
        .section29-form-area ul li .submit-button a
        {
            background: #2c83c7;
            padding: 6px 22px;
            font-size: 18px;
            color: #ffffff;
            float: left;
            border-radius: 8px;
            margin-top: 0px;
            text-decoration: none;
        }
       
        .section29-form-area ul li .submit-button input
        {
            background: #2c83c7;
            padding: 6px 22px;
            font-size: 18px;
            color: #ffffff;
            float: left;
            border-radius: 8px;
            margin-top: 0px;
            text-decoration: none;
            border: none;
        }
       
       
        .section29-comments
        {
            float: left;
            border-top: solid 1px #d3d3d3;
            width: 100%;
            padding-top: 20px;
            margin-bottom: 20px;
        }
       
        .section29-comments-title1
        {
            color: #0082ca;
            font-size: 20px;
            width: 100%;
            text-align: center;
            margin-bottom: 16px;
            font-weight: bold;
        }
       
        .section29-comments-title2
        {
            color: #0082ca;
            font-size: 18px;
            width: 100%;
            text-align: center;
            margin-bottom: 10px;
        }
       
        .section29-comments-title2 span
        {
            color: #686868;
            font-style: italic;
            font-size: 14px;
        }
       
        .section29-comments-content
        {
            color: #606060;
            font-size: 14px;
            width: 98%;
            padding: 0 10px;
            text-align: justify;
            text-align: left;
            line-height: 20px;
        }
       
       
        .btnback
        {
            background: #0083c9;
            float: right;
            padding: 6px 22px;
            font-size: 14px;
            color: #ffffff;
            border-radius: 8px;
            margin-top: 0px;
            text-decoration: none;
            border: none;
            cursor: pointer;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphContents" runat="Server">
    <div class="section29">
        <div class="exhibit1">
            <h2>
                News Details</h2>
        </div>
        <div class="section29-main">
            <div class="section29-imp">
                <div class="section29-common">
                    <asp:Label ID="lblMsgss" runat="server" Visible="false"></asp:Label>
                    <%=strSpeakerProfiles%>
                </div>
            </div>
        </div>
    </div>


        <div id="fb-root">
    </div>
    <script>        (function (d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
            fjs.parentNode.insertBefore(js, fjs);
        } (document, 'script', 'facebook-jssdk'));</script>

    <!-- Start ominature code -->
    <script language="JavaScript" type="text/javascript" src="http://www.resource-event.com/s_code.js"></script>
    <%--Code for home page--%>
    <script language="JavaScript" type="text/javascript"><!--
        /* You may give each page an identifying name, server, and channel on
        the next lines. */

        // These are variables that are to be captured on all pages

        s.pageName = this.document.title; // Pagename based on title tag
        s.pageURL = this.location.href;
        s.pageType = "";
        s.channel = "News Details"; // Typically based on top navigation level, registration, exhibitor zone, speaker list
        s.prop1 = "" // Site Section or top level navigation item
        s.prop2 = "" // Second level navigation item
        s.prop17 = "Anonymous" // User segment, anonymous, registered, etc
        s.prop22 = "" // Pulled from 'Organisation' in registration
        s.prop23 = "" // Pulled from 'Why interested in attending...' in registration
        s.prop25 = "" // Pulled from 'You are interested to' in registration

        /* Conversion Variables */
        s.campaign = ""
        s.state = ""
        s.zip = ""
        s.events = ""
        s.products = ""
        s.purchaseID = ""
        s.eVar16 = ""   // UserID is taken from username once logged in
        s.eVar17 = ""   // Form name, eg. 'Registration Form'
        s.eVar18 = ""   // Social media click, see SDR doc
        s.eVar26 = "Content"   // Content type, blog, exhibitor listing, speaker listing
        s.eVar27 = "News Details"   // Content title, headline of article or blog
        s.eVar31 = ""   // Calendar event, with onClick to Add to Outlook
        s.eVar32 = ""   // Document name, with onClick to exhibitor document
        s.eVar33 = ""   // Exhibitor ID, when on exhibitor page
        s.eVar34 = ""   // Email enquiry, onClick of email enquiry link
        s.eVar35 = ""   // Send to mobile, on send to mobile request

        s.prop19 = "Resource Event 2014 website"
        s.eVar49 = "Resource Event 2014 website"

        /************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
        var s_code = s.t(); if (s_code) document.write(s_code)//--></script>
    <!-- End ominature code -->
</asp:Content>
---------------------------------
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.Text;

public partial class NewsDetails : System.Web.UI.Page
{

    SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
    StringBuilder sb = new StringBuilder();
    protected string strSpeakerProfiles = string.Empty;
    protected string str = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        Security Sec = new Security();
        Sec.CheckStatus();
        Session["eventid"] = "event476";
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Convert.ToString(Request.QueryString["news"])))
                Binddata();
            else
                Response.Redirect("news.aspx");
        }


    }

    private void Binddata()
    {
        try
        {
            SqlDataAdapter oAdapter = new SqlDataAdapter("select *,DATEPART(yyyy,pressdate)as yBlog,DATEPART(dd,pressdate) AS dBlog,CONVERT(varchar(30),DATENAME(MONTH, pressdate)) as mBlog,dbo.StripHTML(initialtext) as metasesc from tblLatestNews where eventid='" + Convert.ToString(Session["Eventid"]) + "' and pressstatus='Valid' and pressid='" + Request.QueryString["news"] + "' order by pressdate desc", conn);
            DataTable dt = new DataTable();
            oAdapter.Fill(dt);
            if (dt.Rows.Count > 0)
            {


                for (int i = 0; i <= dt.Rows.Count - 1; i++)
                {

                    lblMsgss.Text = Convert.ToString(dt.Rows[i]["metasesc"]);
                    Page.Title = Convert.ToString(dt.Rows[i]["title"]);
                    Page.MetaDescription = Convert.ToString(dt.Rows[i]["metasesc"]);
                    Page.MetaKeywords = Convert.ToString(dt.Rows[i]["title"]);

                    //for date
                    sb.Append("<div class='section29-left'><div class='section29-left-text1'>" + dt.Rows[i]["mBlog"].ToString() + "</div><div class='section29-left-text2'>" + dt.Rows[i]["dBlog"].ToString() + "</div><div class='section29-left-text3'>" + dt.Rows[i]["yBlog"].ToString() + "</div></div>");
                    //end date

                    //for description
                    sb.Append("<div class='section29-right'>");
                    sb.Append("<div class='section29-right-title'>" + Convert.ToString(dt.Rows[i]["title"]) + "</div>");
                    sb.Append("<div class='section29-right-content'>" + Convert.ToString(dt.Rows[i]["initialtext"]) + "</div>");
                    sb.Append("<a  style='float:right;' onclick='window.history.back(-1)'><img src='images/go_backnews.jpg' alt='' /></a>");
                    sb.Append("</div>");


                    //end description


                }

                strSpeakerProfiles = Convert.ToString(sb);
            }
            else
            {
                sb.Append("coming soon..");
            }
            strSpeakerProfiles = Convert.ToString(sb);
        }
        catch
        {
            throw;
        }

    }
}
----------------------------------------------
CREATE TABLE [dbo].[tblLatestNews](
[eventid] [nvarchar](50) NULL,
[pressid] [nvarchar](50) NOT NULL,
[title] [nvarchar](250) NULL,
[pressdate] [datetime] NULL,
[initialtext] [ntext] NULL,
[pressstatus] [nvarchar](50) NULL,
[pressdate_dd] [nvarchar](50) NULL,
[pressdate_mm] [nvarchar](50) NULL,
[pressdate_yy] [nvarchar](50) NULL,
[boxno] [varchar](50) NULL,
[boxno1] [varchar](50) NULL,
[logo] [nvarchar](max) NULL,
[shortdesc] [nvarchar](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO---------------------
--------------------

No comments:

Post a Comment