control height returns zero RRS feed

  • Question

  • User185651982 posted

    I have the following code in a custom web control

                            foreach (ICalendarEvent ce in DailyEvents[i])
                                EventDisplay ed = new EventDisplay();
                                ed = new EventDisplay();
                                ed.CalendarEvent = ce;
                                ed.Style.Add("position", "absolute");
                                ed.Style.Add("top", topEvent.ToString() + "px");
                                topEvent += ed.Height.Value;

    I am trying to display a list of events - however the height can change depending on the text within it. At the moment they overlap because the line ed.Height.Value is returning zero. So how can I find the height, in a control

    Thursday, February 9, 2012 5:10 PM


  • User3866881 posted


    Plz make sure that Height is saved into ViewState in "set" property so as to avoid being rendered to zero,bcoz Html is of non-memory when rendering。


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 10, 2012 8:59 PM