Tuesday, March 24, 2015




Hiding a Telerik Menu Choice Based on Role

I have my menu in the site master page. I used the Page_Load() function to make the "Admin" menu item only visible to users with an Admin role.

using System;
using System.Linq;
using Telerik.Web.UI;
using System.Web.Security;



<telerik:RadMenu ID="menu" runat="server" RenderMode="Auto"  >
    <Items>
       <telerik:RadMenuItem    Text="Admin"  Visible="true" />
    </Items>
 </telerik:RadMenu>

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        RadMenuItem item = this.menu.FindItemByText("Admin");
        if (null != item)
        {
            if (Roles.IsUserInRole("Admin"))
            {
                item.Visible = true;
            }
            else
            {
                item.Visible = false;
            }
        }
    }
}

Thursday, January 1, 2015

Is 2015 the year?

The New Year brings a time to reflect on the possible. Is 2015 the year you’ll take your business and profession to the next level?

Your greatest success may be around the next bend in the road.

Visit Blue Canyon Software if your ready to create custom software to improve your business in 2015.

Here’s to the success of the entrepreneur and to all others waking up each morning ready to make a difference!

Tuesday, December 16, 2014


Pool Service Online is Live!

I just completed a new web site for www.PoolServiceOnline.com . Check it out.   There is great information for pool owners to include informative video tutorials about pool maintenance.The owner is extremely knowledgeable and experienced.

Pool Service Online also has an online Pool Prescription Software  if you create a free profile identifying your pool size, filter type, etc.  

Contact me through my website at www.BlueCanyonSoftware.com if you need a website or custom software to manage your data.

Tuesday, October 21, 2014

Custom Software Is Your Competitive Advantage


Entrepreneurs are a passionate group that love what they're doing.   They use  their skills and ideas to start businesses.  Long hours and intense focus can be the norm.

Pressures rising from competitors and the escalating need to "run" the business  potentially pulls entrepreneurs away from their passion of doing the work and implementing their ideas.

You started your business on an idea that is unique.  Managing the business involves unique processes and data management requirements.   Custom software can be provide the data management advantage you need to run your business and provide unique services to your customers.

Contact Blue Canyon Software to create the custom software data system you need to manage repetitive processes, provide insight into your business, and bring innovative interaction to your customers.

Wednesday, October 15, 2014

Set Cursor To Image From Code Behind

Changing the cursor to something unexpected is not a good idea most of the time because it may confuse your users. However, there may be times when it fits the situation well.

This is how I do it using ASP.NET and C#.   The basic idea is to create a class with the cursor property set to an image and then add that class to a div from code behind.

In this example,  I'm using FormsAuthentication and I want to change the cursor only when "chuck" is logged in.

CSS

Create a class definition for chuck like the following.

 .chuck{ cursor: url(../images/littleChuck.png), auto; }

A couple of things to note here:
  • Use a small image. Don't exceed 32px in length or width
  • Use a url path relative to the page using the image, not relative to the css file.
  • Always follow the url() with auto. Just two values --> cursor: url(), auto;

Identify the div to Apply Cursor

You need something to apply the css class to in the code behind. Let's use a div for this example.

Don't forget to use the runat="server" on the div so we can access the div from the code behind.

<div id="wrapper"   runat="server" > 

</div>

C# in Code Behind

Add the "chuck" class to the wrapper div if the logged in user name is "chuck".

if(HttpContext.Current.User.Identity.Name.ToLower() == "chuck" )
{
       wrapper.Attributes.Add("class", "chuck");
}


Summary

Changing the cursor to image is only one of many values that can be applied.  Check out this link at w3schools to experiment with the 30+ values.

Visit Blue Canyon Software if you need a Senior Software Developer for your custom software project.


Wednesday, July 16, 2014

Choosing the Right Color

There are plenty of tools on the Internet to pick colors. One of my favorites to find a nice pallet of colors is the Adobe Kuler Color Wheel .

Sometimes you would like to find the small variation of shades between two colors. I like the Color Mixer tool at w3Schools for this.

Thursday, July 10, 2014

Avoid Resubmitting Events On Web Page Refresh

Resubmitting events during a web page refresh can be detrimental. For example, you don't want your code to make another add to the database or resubmit a credit card charge. You could redirect your user to a confirmation page when a submit button is pressed. A page refresh will only affect the confirmation page. That may not fit your scenario.

Using ASP.NET ViewState

I ran across a nice piece of code at http://stackoverflow.com/a/8010057/3817299 and repeated below that detects a page refresh using the ViewState.

Add this in your class:
#region Browser Refresh

private bool refreshState;
private bool isRefresh;

protected override void LoadViewState(object savedState)
{
  object[] AllStates = (object[])savedState;
  base.LoadViewState(AllStates[0]);
   refreshState = bool.Parse(AllStates[1].ToString());
   if (Session["ISREFRESH"] != null && Session["ISREFRESH"] != "")
   isRefresh = (refreshState == (bool)Session["ISREFRESH"]);
}

protected override object SaveViewState()
{
   Session["ISREFRESH"] = refreshState;
   object[] AllStates = new object[3];
   AllStates[0] = base.SaveViewState();
   AllStates[1] = !(refreshState);
   return AllStates;
}

#endregion

And in your button click do this:

protected void Button1_Click(object sender, EventArgs e)
{
   if (isRefresh == false)
   {
     Insert Code here
   }
}

Using AJAX

You can also avoid the event re-submission by using AJAX to handle your button events.