Telerik blogs

Latest

  • Web ASP.NET AJAX

    On dynamically creating server controls

    Every once in a while I see code which looks like that:public class MyCustomControl : WebControl{     protected override void Render(HtmlTextWriter output)     {          SomeControl someControl = new SomeControl ();          someControl.ID = "SomeID";          someControl.SomeProperty = "SomeValue";          someControl.RenderControl(output);    }}There are two problems with this code: The child control is instantiated in the Render methodFrom control execution lifecycle’s point of view it is too late to instantiate controls in the Render method. Even if you add them in the controls collection some features won’t work just because it’s too late – postbacks, viewstate to name a few. The child control is never added to the controls collection. This means...
    September 28, 2007
  • Web

    How wrong custom ViewState handling may harm more than help

    As some of us have found last Friday this article in MSDN about how to store your ViewState in Session is totally wrong. Using the Reflector you can find very easily that ControlState will be erased if you access more than once PageStatePersister. The correct implementation should be:      PageStatePersister _pers;      protected override PageStatePersister PageStatePersister      {          get          {              if (_pers == null)                  _pers = new SessionPageStatePersister(this);              return _pers;          }      } How about overriding SavePageStateToPersistenceMedium / LoadPageStateFromPersistenceMedium? If you do this you should update your PageStatePersister or you will miss the ControlState once again. Example: protected override object LoadPageStateFromPersistenceMedium() {      object state = THESTATE;      if (state is Pair)      {          Pair statePair = (Pair)state;          PageStatePersister.ControlState =...
    September 26, 2007
  • Web

    How To: Format RadGrid PDFs

    On Monday, I showed you some the new settings in RadGrid 5 the enable you to control certain aspects exported PDFs. We looked at how you can easily set the PDF's metadata, change its filename, and even control the PDF's security settings. All of these settings- along with the ability to force the PDF to open in a new window- can be set with a single property in the Grid's new ExportSettings configuration block. What we didn't look at on Monday is how you can control the formatting of your exported PDFs. Today we'll take a look at how you can customize...
    September 19, 2007
  • Web ASP.NET AJAX

    The new default skin (and how to switch back :)

    With the Q2 release, we have decided it is time to refresh the look and feel of RadControls components to stay on the edge of the latest trends in visual design for the web. And ever since Vista, black is the new white… so we just had to join in with a trendy new theme for the default skins of our controls. The Q2 2007 skin sports a modern black twist, improved contrast, and larger font-sizes/more generous white space for a touch of web2.0 in your applications. While we ardently urge everyone to switch to the new look, we do...
    September 19, 2007
  • Web

    First Look: RadGrid 5 PDF Export (updated)

    By now you probably know that one of the biggest new features in RadGrid 5.0 is support for export to PDF. For quite some time, RadGrid has supported direct export to Microsoft Word and Excel formats, but the addition of PDF export elevates the Grid's exporting capabilities to unprecedented levels. Using the new export feature couldn't be easier. As with previous export formats, all that is required is a call to a single simple RadGrid method: this.RadGrid1.MasterTableView.ExportToPdf();When you call this method, all of the data in the Grid is exported to a new PDF that the users can then save to their local...
    September 17, 2007