Posts

Showing posts with the label mvc

How to inspect the values inside the route in ASP.Net MVC C#

public ActionResult Index() {     var Controller = RouteData.Values[ "controller" ];     var Action = RouteData.Values[ "action" ];     var Id = RouteData.Values[ "id" ];     string Output = string .Format( "Controller = {0}, Action= {1}, Id= {2}" ,                Controller, Action, Id);     ViewBag.Message = Output;     return View(); }

Check whether model is loaded or not.

Following function will check whether model is loaded in codeigniter. Pass the model name as argument to the following function. function is_model_loaded ( $model ) { $ci =& get_instance (); $load_arr = ( array ) $ci -> load ; $mod_arr = array (); foreach ( $load_arr as $key => $value ) { if ( substr ( trim ( $key ), 2 , 50 ) == "_ci_models" ) $mod_arr = $value ; } //print_r($mod_arr);die; if ( in_array ( $model , $mod_arr )) return TRUE ; return FALSE ; }