Author: karinelvira | Posted on: 10/18/2010 5:16:18 AM | Views : 255

I have a textbox where email addresses are displayed at the click of a button. There is one problem, before the first email address there are two empty spaces. Is there any way of getting rid of them? The result looks like this: "  emailaddress; emailaddress; emailaddress;"
Here's my button click:

protected void ButtonEmailNewsletter_Click(object sender, EventArgs e) { TextBoxEmailNewsletter.Text = " "; SqlConnection conn = new SqlConnection(config); conn.Open(); string sql = "SELECT email FROM NewsletterRecipients"; SqlCommand comm = new SqlCommand(sql, conn); SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { TextBoxEmailNewsletter.Text += (dr[0] + "; "); } dr.Close(); conn.Close(); }



...

Go to the complete details ...