Need help in displaying data insider marquee

Posted by user59637 on Stack Overflow See other posts from Stack Overflow or by user59637
Published on 2009-03-29T06:27:00Z Indexed on 2010/04/08 19:03 UTC
Read the original article Hit count: 305

Filed under:

Hi all, I want to display news inside the marquee markup in my banking application but its not happening.Please somebody help me what is the error in my code.Here is my code:

<marquee bgcolor="silver" direction="left" id="marq1" runat="server" behavior="scroll" scrolldelay="80" style="height: 19px" width="565">
<% 
   String se = Session["countnews"].ToString();
   for (int i = 0; i < int.Parse("" +se); i++)
   { %>
       <strong><%Response.Write("&nbsp;&nbsp;" + Session["news"+i] + "&nbsp;&nbsp;"); %></strong>
<% } %>
</marquee>

public class News
{
    DataSet ds = new DataSet("Bank");
    SqlConnection conn;
    String check;
    SqlDataAdapter sda;
    int i;
    public string News_Name;
    public int Count_News;
public int newsticker()
    {
        conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BankingTransaction"].ConnectionString.ToString());
        check = "Select NewsTitle from News where NewsStatus = 'A'";
        sda = new SqlDataAdapter(check, conn);
        sda.Fill(ds, "News");
        if (ds.Tables[0].Rows.Count > 0)
        {
            for (i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                News_Name =i+ ds.Tables[0].Rows[i].ItemArray[0].ToString();
            }
            Count_News = ds.Tables[0].Rows.Count;        }
        else
        {
            News_Name =0+ "Welcome to WestSide Bank Online Web site!";
            Count_News = 1;
        }
        return int.Parse(Count_News.ToString());       
    }

protected void Page_Load(object sender, EventArgs e)
    {
        News obj = new News();
        try
        {
            obj.newsticker();
            Session["news"] = obj.News_Name.ToString();
            Session["countnews"] = obj.Count_News.ToString();       
        }
        catch (SqlException ex)
        {
            Response.Write("Error in login" + ex.Message);
            Response.Redirect("Default.aspx");
        }
        finally
        {
            obj = null;
        } 
    }

© Stack Overflow or respective owner

Related posts about marquee