Telerik blogs

Latest

  • Productivity

    Saving a few lines of code. Part V - Raising events.

    As you read the title of this post you may ask yourself - Hmmm, raising an event... wasn't that achievable with 1-2 lines of code? How smaller could it get, 0 lines of code? And you're almost right, to raise an event is not such a big deal. Supposing you have an event of type EventHandler. public event EventHandler Clicked;     Typically you have a virtual protected method which raises the event: protected virtual void OnClicked(EventArgs e)   {       if (Clicked != null)           Clicked(this, e);   }    Pretty simple unless you want to be thread safe (well... almost thread safe), then you should add one additional line: protected virtual void OnClicked(EventArgs e)...
    May 27, 2021 2 min read
  • Productivity Document Processing

    Exporting data to Excel using the RadGridView for WinForms

         There usually comes a time for most developers when they need to use the data being displayed in an application, outside of that application.  There are obviously a number of ways you can present data, but it is common to leverage Microsoft Excel.  It provides a similar look and feel to the grid which means minimal reformatting, plus Excel is widely used and therefore most offices should have a version of the software available.       How to get your data into Excel?  The RadGridView offers a couple of options to accomplish this task.  First, you can use the Primary...
    May 27, 2021 3 min read
  • Productivity

    Saving a few lines of code. Part IV - Refactoring switch statements

    Before going into details about how you could refactor a switch statement first I should say that there's nothing wrong with this statement (as with any other C#, VB.NET or whatever statement). Most probably you would want to refactor a switch in one of these scenarios: It has reached a certain amount of lines of code so that you need to scroll in order to see all the cases. When you want to introduce some new functionality you inevitably end up adding new cases to the switch statement. When you implicitly check for a type in a switch statement. In most...
    May 27, 2021 4 min read
  • Productivity Testing

    Selenium Extensions for RadControls (ASP.NET AJAX)

    Although I ended my Selenium adventure a few months ago, there is a final topic I’d like to cover here. This one completes my set of posts concerning RadControls for ASP.NET AJAX test automation with Selenium. The tool, the Telerik ASP.NET QA team relied on during the past couple of years, helped us catch in time most of the bugs in RadControls that never came into production! A curios fact here is that Selenium 1.0 official release is finally coming soon after many years of development! Check out the recent post on Selenium blog announcing the exciting news. ...
    May 27, 2021 4 min read
  • Productivity Reporting

    Reporting: How to set default value for a multivalue parameter

    Generally when you want to set a default value for a parameter, you use the Value property of the parameter (this.ReportParameters["MyParam"].Value), but what to set when you want all values to be selected by default  i.e you have a multivalue parameter? You can do that by providing an ArrayList containing all your values to the report parameter Value property. For consistency of the Tips & Tricks series, I am going to use the project from the Using Report parameters UI to sort by column blog post. Let's make the SortByColumn parameter accept multivalues by setting the MultiValue property to True. We...
    May 27, 2021 2 min read