Learn As Much As You Can

Friday 15 March 2013

How to format the string in the title property of the image tag(values comes from the database)

using (SqlConnection conn = DataAccess.GetConnected())
            {
                SqlCommand cmd = new SqlCommand("GetImageForSlider", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataReader sqr = cmd.ExecuteReader();
                while (sqr.Read())
                {
                    string image_path = sqr.GetString(0);
                    string description = sqr.GetString(1);
                    string action = sqr.GetString(2);
                    HtmlImage += string.Format("<img src=\"{0}\" title=\"<h3>{1}.</h3><span class=price>{2}</span><p><br></p><a href=http://www.giftotravels.com >This is link</a>\"/>",image_path, description, action);
                }
            }


0 comments :

Post a Comment