Creating a Function

Implementing a simple search

Code Examples

Creating a Function

At the the top of the page

@section head {

	@RenderSection("head")
}

    @functions {

    
    		string DistrictName {

        		get {

            			switch(Request.Friendly) {
            
                		case "ardmoredistrict":

                    				return "Ardmore District"; 
        
            
                	case "bartlesvilledistrict":

                    				return "Bartlesville District";
            
                		
           
                		default:

                    				return String.Empty;

                    
            }

        		}

    		}

    
    
	ConditionMeta.ConstantValue _districtCondition = null;

    
    ConditionMeta.ConstantValue DistrictValue {

        	get {

            		if (_districtCondition == null)

                		_districtCondition = new ConditionMeta.ConstantValue {Value = DistrictName};
            
            	return _districtCondition;

        	}

    	}


}
Written: 4/17/2019

Implementing a simple search

Useful if you are looking to implement a basic search of just one view

For Bootstrap 2

<form method="get" class="form-inline">
	<div class="input-append">Search: 
		<input class="span5" name="search" value="@Request.QueryString["search"]" type="text" />
		<button class="btn" type="submit">Search churches</button>
	</div>
</form>

For Bootstrap 3

<form method="get"  class="form-inline breadcrumb"  role="form">
    <div class="form-group  col-md-9">
     <label for="search" class="sr-only">Search: </label>          
	 <input class="form-control" name="search" value="@Request.QueryString["search"]" type="text" />
	</div>            
    <button class="btn btn-default" type="submit">Search churches</button>
</form>
Written: 4/17/2019