I need to hide ThumbnailsArea of RadImageGallery when it has only one image. I set width and height to zero to achieve the goal on databound event:

protected void RadImageGallery1_DataBound(object sender, EventArgs e)
        SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["****"].ConnectionString);

        SqlCommand cmd = new SqlCommand("SELECT COUNT(*) FROM adtv WHERE prid = @prid", connection);

        Int32 count = (Int32)cmd.ExecuteScalar();

        if (count < 2)
            RadImageGallery1.ThumbnailsAreaSettings.Height = 0;

        RadImageGallery1.ThumbnailsAreaSettings.Width = 0;

Is there any way to get Image count rather than selecting count on databound event?

And is there any good way to hide the area instead of setting width and height to zero?

0 Answers