/// <summary>
 ///     Handles the ItemCommand event of the _rgSearchResults control.
 /// </summary>
 /// <param name = "sender">The source of the event.</param>
 /// <param name = "e">The <see cref = "Telerik.Web.UI.GridCommandEventArgs" /> instance containing the event data.</param>
 protected void _rgSearchResults_ItemCommand(object sender, GridCommandEventArgs e)
 {
     switch (e.CommandName)
     {
         case "Location":
             {
                 int itemId;
                 if (int.TryParse(e.CommandArgument.ToString(), out itemId) && itemId > 0)
                 {
                     var db = new UrbanDataContext();
                     var room = db.Manager.Room.GetByKey(itemId);
                     var building = new BuildingSerialObj(room);
                     var address = building.ToJson();
                     RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(String.Format("return ShowAddressLocation('{0}','{1}');", address, false));
                 }
             }
             break;
         case RadGrid.ExportToPdfCommandName:
             _isPdfExport = true;
             break;
         case RadGrid.RebindGridCommandName:
             _rgSearchResults.Rebind();
             break;
         case RadGrid.FilterCommandName:
             break;
         case "ViewDetails":
             {
                 if (e.CommandArgument != null && (string) e.CommandArgument != String.Empty)
                     RadAjaxManager.GetCurrent(Page).Redirect("~/App/Pages/RoomDetails.aspx?roomId=" + e.CommandArgument);
             }
             break;
     }
 }
 /// <summary>
 ///     Handles the Click event of the _btnViewLocation control. <br />
 ///     Turns the address into json object and passes to javascript function on page.
 /// </summary>
 /// <param name = "sender">The source of the event.</param>
 /// <param name = "e">The <see cref = "System.EventArgs" /> instance containing the event data.</param>
 protected void _btnViewLocation_Click(object sender, EventArgs e)
 {
     var db = new UrbanDataContext();
     var room = db.Manager.Room.GetByKey(RoomId);
     var building = new BuildingSerialObj(room);
     var address = building.ToJson();
     RadAjaxManager.GetCurrent(Page).ResponseScripts.Add(String.Format("return ShowAddressLocation('{0}');", address));
 }