views:

11

answers:

1

Hi Experts,

I am using asp.net with C#.

I have a adrotator which I am binding through the database. I have following column in database table

  1. AdId
  2. AdTitle
  3. AlternateText
  4. ImageUrl
  5. NavigateUrl
  6. AdDescription

It is binding correctly and showing the data, now I want a label on the right of the adrotator which show the AdDescription, but it is showing the first record only. I'll try to explain you with the code

 private void GetPopUpData()
{
    string conn = "Data Source=KKR;Initial Catalog=XYZ;Integrated Security=True";
    SqlConnection Scon = new SqlConnection(conn);
    Scon.Open();
    SqlDataAdapter da = new SqlDataAdapter("Select * FROM tblAd", Scon);
    DataSet ds = new DataSet();
    da.Fill(ds);
    AdRotator1.DataSource = ds.Tables[0];
    AdRotator1.DataBind();

    lblDesc.Text = ds.Tables[0].Rows[0]["AdDescription"].ToString();


}

 protected void timer1_Tick(object sender, EventArgs e)
{
    GetPopUpData();
}

Please help me in displaying the text data on the right side of the adrotator, as it is only showing the data of the first record. might be because i have used Rows[0].

Thanks in advance

A: 

Not behind my IDE right now, but is there an ActiveRow or similar property you could be using?

Also, if the cursor in the table behind the addrotator is changing, you could also hook to a data event instead of a timer or popup, this might be cleaner.

Tobiasopdenbrouw