Posted on 7/12/2011

Storing phone numbers in a table without the dashes and parenthesis sounds like a good idea, until you need to retrieve and format them correctly. As always, reading the documentation - and understanding it - can be time consuming and frustrating. Which it was! But this is what I finally came up with...

This will return (123) 456-7890

public partial class Report1 : Telerik.Reporting.Report
        public Report1()

        public static string FormatPhoneNumber(string phoneNumber)
            if (phoneNumber.Length == 10)
                return "(" + phoneNumber.Substring(0, 3) + ") " + 
                      phoneNumber.Substring(3, 3) + "-" +
                return "no phone number";

Then in the "Value" property of the text box use the following: =FormatPhoneNumber(Fields.Phone)

Of course, you can modify this and take into consideration that the phone number may not have an area code. But who doesn't use area codes?

Posted on 7/6/2011

Here is a quick way to load the states into a RadComboBox.

Cut and paste the ComboBox.xml into an separate .xml file. Then place BindComboBox() into the code-behind of the .aspx file and call it from Page_Load().

The values in the list can be modified, but it should save time instead of creating it from scratch

private void BindStateCombo()
            // load State combo box
            string path = "combobox.xml";
            StreamReader sr = method(path);

private StreamReader method(string path)
            StreamReader sr = new StreamReader(Server.MapPath(path));
            return sr;

protected void Page_Load(object sender, EventArgs e)
            if (!Request.IsAuthenticated) { Response.Redirect("Login.aspx"); }

              // load combo boxe




<?xml version="1.0" encoding="utf-8" ?>
<Item Text="States" IsSeparator="true" />
<Item  Value="AL" Text="Alabama" />
<Item  Value="AK" Text="Alaska" />
<Item  Value="AZ" Text="Arizona" />
<Item  Value="AR" Text="Arkansas"  />
<Item  Value="CA" Text="California"  />
<Item  Value="CO" Text="Colorado" />
<Item  Value="CT" Text="Connecticut" />
<Item  Value="DC" Text="District of Columbia" />
<Item  Value="DE" Text="Delaware" />
<Item  Value="FL" Text="Florida" />
<Item  Value="GA" Text="Georgia" />
<Item  Value="HI" Text="Hawaii" />
<Item  Value="ID" Text="Idaho" />
<Item  Value="IL" Text="Illinois" />
<Item  Value="IN" Text="Indiana" />
<Item  Value="IA" Text="Iowa" />
<Item  Value="KS" Text="Kansas" />
<Item  Value="KY" Text="Kentucky" />
<Item  Value="LA" Text="Louisiana" />
<Item  Value="ME" Text="Maine"  />
<Item  Value="MD" Text="Maryland" />
<Item  Value="MA" Text="Massachusetts" />
<Item  Value="MI" Text="Michigan" />
<Item  Value="MN" Text="Minnesota" />
<Item  Value="MS" Text="Mississippi" />
<Item  Value="MO" Text="Missouri" />
<Item  Value="MT" Text="Montana" />
<Item  Value="NE" Text="Nebraska" />
<Item  Value="NV" Text="Nevada" />
<Item  Value="NH" Text="New Hampshire" />
<Item  Value="NJ" Text="New Jersey" />
<Item  Value="NM" Text="New Mexico" />
<Item  Value="NY" Text="New York" />
<Item  Value="NC" Text="North Carolina" />
<Item  Value="ND" Text="North Dakota" />
<Item  Value="OH" Text="Ohio" />
<Item  Value="OK" Text="Oklahoma" />
<Item  Value="OR" Text="Oregon" />
<Item  Value="PA" Text="Pennsylvania" />
<Item  Value="RI" Text="Rhode Island"  />
<Item  Value="SC" Text="South Carolina"  />
<Item  Value="SD" Text="South Dakota" />
<Item  Value="TN" Text="Tennessee" />
<Item  Value="TX" Text="Texas" />
<Item  Value="UT" Text="Utah" />
<Item  Value="VT" Text="Vermont" />
<Item  Value="VA" Text="Virginia" Selected="True" />
<Item  Value="WA" Text="Washington" />
<Item  Value="WV" Text="West Virginia" />
<Item  Value="WI" Text="Wisconsin" />
<Item  Value="WY" Text="Wyoming" />


Download:  combobox.xml (2.09 kb)