[CLOSED] Change Icon based on model value

  1. #1

    [CLOSED] Change Icon based on model value

    I have a property in my model called IsLocked, and I was wondering how would I change the icon on a TextFieldFor control?

    Html.X().TextFieldFor(m => m.FirstName, false)
                                    .Icon(Icon.Lock)
                                    .ReadOnly(Model.IsLocked)
                                    .FieldLabel("First Name"),
    I would only want to show the Lock icon when Model.IsLocked == true.

    Thanks,
    Amit
    Last edited by Baidaly; Oct 21, 2013 at 3:24 PM. Reason: [CLOSED]
  2. #2
    Hello!

    Try the following:

    Html.X().TextFieldFor(m => m.FirstName, false)
    	.Icon(Model.IsLocked ? Icon.Lock : Icon.None)
    	.ReadOnly(Model.IsLocked)
    	.FieldLabel("First Name"),
  3. #3

    Perfect

    Icon.None ... that's great!

Similar Threads

  1. [CLOSED] FormPanel + Change field type based on a value
    By bossun in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 24, 2012, 1:00 PM
  2. Replies: 0
    Last Post: Jul 10, 2012, 9:33 AM
  3. [CLOSED] Set a Command Columns Icon based on a Column Value
    By sisa in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 15, 2011, 1:54 PM
  4. Replies: 1
    Last Post: Jun 02, 2011, 9:19 PM
  5. [CLOSED] How to change panel based on ComboBox value
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 22, 2010, 10:25 AM

Tags for this Thread

Posting Permissions