My MVC is below:


Ext.define('test.model.mdlPerson', {
    extend: '',
    fields: [
        { name: 'name' },
        { name: 'surname' }, 
        { name: 'email' }


Ext.define('', {
    extend: '',
    model: 'test.model.mdlPerson',
    data: [
        { name: 'Edddd', surname: 'dfasd', email: '' },
        { name: 'Tommy', surname: 'dfgdfgdfg', email: '' }
    storeId: 'Person'

GridPanel VIEW:

Ext.define('test.view.GridPanel', {
    extend: 'Ext.grid.Panel',
    title: 'The GridPanel',
    alias: 'widget.gridpanel',
    itemId: 'gridPanelId',
    store: 'Person',
    initComponent: function() {
        columns : [
                { text: 'Name', dataIndex: 'name' },
                { text: 'Surname', dataIndex: 'surname' },
                { text: 'E-mail', dataIndex: 'email' }


Ext.define('test.controller.GridPanel', {
    extend: '',
    stores: ['Person'],
    models: ['mdlPerson'],
    views: ['GridPanel'],
    refs: [{
        ref: 'gridpanel',
        selector: 'gripanel'

The problem is that the store can't be loaded. I have tried also the getStore() method but nothing appears. Anyone help here! Thank you very much!!!

I'm looking for a bit of experience and explanation here, given that different sources give different recommendations. I am totally new to MVC. I know this question has been asked before, but I am not (currently) using EF or Linq.

I have a SQL database with many stored procedures. Previously when used with webforms, there was a business layer that contained helper methods for calling the procedures and returning DataSets to the pages. The important part is that the procedures often interrogated about 20 tables; the pages do not simply reflect the database structure exactly (as I see in the majority of MVC tutorials):

SQL database <--> stored procedures <--> business layer <--> web forms

I want to take the best approach here to start on the right footing and learn properly but appreciate there may not be a correct answer. Therefore if you post, could you please offer some explanation as to "why"?

  • Should stored procedure logic (SQLCommand/business methods etc) go within Model or Controller?

One post advises neither, but retain the business layer. Another expert advises that

[Models/Entities] should not have any addon methods outside of what's coming back from the database

  • If the business layer is retained, where are the methods called from (e.g. Model or Controller)?

  • If the above answer is "Neither", does that mean the Model part will go unused?

That almost feels that things aren't being done properly, however in this tutorial that appears to be what happens.

  • Should I plug in the Entity Framework into the Model layer to call the business layer?

That feels like overkill, adding all that additional logic.

I have a question regarding SSRS authentication. I have deployed my reports on a live server and after I access these reports using the live URL it shows "authentication failed" error. My purpose is that anyone from the universe can access the reports but how can I do that? i.e let everyone access that specific URL to see the reports. I am using SQL Server Authentication here.

It runs fine when I run that application on the local server because it has rights to access the that report but the story starts when I try to access the report placed on the live server.

Thanks in advance

This error occurred in & C# program:

System.Data.SqlClient.SqlConnection' in Assembly 'System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable

what is the reason for this type of error occurred?

I was looking for a solution as to how to save data from joomla frontend. I came across the following code for controller and model which works perfectly. But I was looking for a standard practice like its done in the back end using jform, jtable etc ... In the following code (inside model), the saving technique do not look so appealing. And I am totally without any idea how the server side validations is implemented.

It might be confusing, so i would like to reiterate that in the backend we don't even have to write the add or save or update function, it is automatically handled by the core classes with both client and server side validation. So i was looking for something like that.



// No direct access.
defined('_JEXEC') or die;

// Include dependancy of the main controllerform class

class JobsControllerRegistration extends JControllerForm
    public function getModel($name = 'Registration', $prefix = 'JobsModel', $config = array('ignore_request' => true))
        return parent::getModel($name, $prefix, array('ignore_request' => false));

    public function submit()
       // Check for request forgeries.
       JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

        // Initialise variables.
        $app    = JFactory::getApplication();
        $model  = $this->getModel('Registration');

        // Get the data from the form POST
        $data = JRequest::getVar('jform', array(), 'post', 'array');

        $form   = $model->getForm();
        if (!$form) {
            JError::raiseError(500, $model->getError());
            return false;

        // Now update the loaded data to the database via a function in the model
        $upditem    = $model->updItem($data);

        // check if ok and display appropriate message. This can also have a redirect if desired.
        if ($upditem) {
            echo "<h2>Joining with us is successfully saved.</h2>";
        } else {
            echo "<h2>Joining with us faild.</h2>";

    return true;



// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Include dependancy of the main model form
// import Joomla modelitem library
// Include dependancy of the dispatcher
* HelloWorld Model
class JobsModelRegistration extends JModelForm
     * @var object item
    protected $item;

     * Get the data for a new qualification
    public function getForm($data = array(), $loadData = true)

        $app = JFactory::getApplication('site');

        // Get the form.
        $form = $this->loadForm('com_jobs.registration', 'registration', array('control' => 'jform', 'load_data' => true),true);

        if (empty($form)) {
            return false;
        return $form;

    //Nwely added method for saving data
    public function updItem($data)
        // set the variables from the passed data
        $fname = $data['fname'];
        $lname = $data['lname'];
        $age = $data['age'];
        $city = $data['city'];
        $telephone = $data['telephone'];
        $email = $data['email'];
        $comments = $data['comments'];

        // set the data into a query to update the record
        $db = $this->getDbo();
        $query  = $db->getQuery(true);

        $db =& JFactory::getDBO();
        $query = "INSERT INTO #__joinwithus ( `id`, `firstname`, `lastname`, `age`, `city`, `telephone`, `email`, `comment`)
    VALUES (NULL,'" . $fname . "','" . $lname . "','" . $age . "','" . $city . "','" . $email . "','" . $telephone . "','" . $comments . "')";


        if (!$db->query()) {
            JError::raiseError(500, $db->getErrorMsg());
            return false;
        } else {
            return true;

Can somebody kindly point me to a good tutorial or share me a component which deals with form in the frontend with joomla 2.5.

I have an Angular directive that implements what is essentially a custom combobox. Clicking on the input control causes another div to appear below it and show a list of contained divs from a model object. You can type text into the input control and it filters the list of divs below it.

I have a few separate button objects (not part of the directive, but in the same scope) that call methods like $scope.clearFilter() or $scope.unselectAll(), which, in turn, call directiveScope.clearFilter() or directiveScope.unselectAl(). directiveScope is a shared object between the combobox directive and the main controller. It gives the controller the ability to call methods on the directive directly.

Sorry I can't post a Plunker due to license issues.

I've been told that having an Angular controller call a method on the directive directly is not good design, but according to Wikipedia's page on MVC:

A controller can send commands to the model to update the model's state (e.g., editing a document). It can also send commands to its associated view to change the view's presentation of the model (e.g., by scrolling through a document).

This sounds like exactly what I am doing if "send commands" is synonymous with "call functions", and if you consider a directive a "view", which I do, since directives are essentially extensions of HTML.

I've seen StackOverflow posts like this one that also suggest it's a bad idea (with no justification of that position), but the recommended alternative of implementing a separate service to handle this state seems like an unnecessarily complex solution, especially since I have multiple instances of these combobox directives. You end up with a directive that doesn't even know its own view state, which just seems very wrong.

I don't see why calling SomeService.clearFilter(), which then sets some "state" that the directive has to $watch() for, is better than just calling someDirective.clearFilter() and avoiding all the overhead. The controller still has to know about clearing the filter. It just has to get injected with SomeService instead of being connected to the directive.

So, Angular/MVC experts, please tell me why this is wrong (or why it's okay)! :-)


I am using the Footer Template for add new rows in GridView.

In the Footer Template I have three DropDownList.

In the DropDownList DZ_DDL I have this values:


In the DropDownList M_DDL I have this values:


I need to check this:

  • If in the dropdownlist DZ_DDL selected value are ZA or ZF or ZG or ZL or ZM I need disabled in the dropdownlist M_DDL the values ZVR and ZTR.
  • If in the dropdownlist DZ_DDL selected value is ZVR I need disabled in the dropdownlist M_DDL the values Z and ZTR.
  • If in the dropdownlist DZ_DDL selected value is ZTR I need disabled in the dropdownlist M_DDL the values Z and ZVR.

Can you explain how do this ?

My code below:

if (e.Row.RowType == DataControlRowType.Footer)
    DropDownList DZ_DDL = (DropDownList)e.Row.FindControl("DZ_DDL");
    DropDownList Level_DDL = (DropDownList)e.Row.FindControl("Level_DDL");
    DropDownList M_DDL = (DropDownList)e.Row.FindControl("M_DDL");

    sql1 = " SELECT ....; ";
    OdbcCommand cmd = new OdbcCommand(sql1);
    DZ_DDL.DataSource = GetData(cmd);
    DZ_DDL.DataTextField = "name";
    DZ_DDL.DataValueField = "name";

    sql2 = " SELECT ....; ";
    OdbcCommand cmd2 = new OdbcCommand(sql2);
    Level_DDL.DataSource = GetData(cmd2);
    Level_DDL.DataTextField = "PZA";
    Level_DDL.DataValueField = "PZA";

    sql3 = " SELECT ....; ";
    OdbcCommand cmd3 = new OdbcCommand(sql3);
    M_DDL.DataSource = GetData(cmd3);
    M_DDL.DataTextField = "Name";
    M_DDL.DataValueField = "Name";

Pls Help Me The problem here is that i want the empty data template to be Display after the button search has been click but right now every time i open the page, it will show the empty data template before do any searching ....

before asking for help from you guys , I did some research on the internet for a long time but could not reach any conclusion.

I created a new resevation page in opencart to determine the days and hours. you can see in the screenshot

I want to do for example : if someone checked saturday 09:00 am this value need to send sql. i created tables for all hours in sql.

my problem is I cant connected checkbox's and sql.

this codes what I used.

.TPL page

<input type="checkbox" name="day101"  value="<?php echo $day101; ?>" />   
   <?php   if(isset($_POST['day101'])){
    //$day101 is checked and value = 1
    $day101 = $_POST['day101'];
    //$day101 is nog checked and value=0

model page

day101 = '" . $this->db->escape($data['day101'])

and controller page

if (isset($this->request->post['day101'])) {
            $this->data['day101'] = $this->request->post['day101'];
        } elseif (isset($customer_info)) {
            $this->data['day101'] = $customer_info['day101'];
        } else {
            $this->data['day101'] = '';

I am sory about my english , still learning and not familiar whit opencart and MVC . if you guys help me I will be thankful.

I have created a custom authentication and authorisation for my users.The problem I am facing is how to get mvc to check that role from inside my users table matches the [Authorize(Role)] on my controller so as to set httpauthorised to true.Below is my customauthorise class.

 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public class CustomAuthorizeAttribute : AuthorizeAttribute 
    public override void OnAuthorization(AuthorizationContext filterContext)
        if (!filterContext.HttpContext.User.Identity.IsAuthenticated)
            filterContext.Controller.TempData["ErrorDetails"] = "You must be logged in to access this page";
            filterContext.Result = new RedirectResult("~/User/Login");

        if (filterContext.HttpContext.Request.IsAuthenticated)
            using (var db = new GManagerDBEntities())
                var authorizedRoles = (from u in db.Users
                                       where u.Username == filterContext.HttpContext.User.Identity.Name
                                       select u.Role).FirstOrDefault();
                Roles = String.IsNullOrEmpty(Roles) ? authorizedRoles.ToString() : Roles;

        if (filterContext.Result is HttpUnauthorizedResult)
            filterContext.Controller.TempData["ErrorDetails"] = "You do nat have necessary rights to access this page";
            filterContext.Result = new RedirectResult("~/User/Login");

    public CustomAuthorizeAttribute(params object[] roles)
        if (roles.Any(r => r.GetType().BaseType != typeof(Enum)))
            throw new ArgumentException("roles");

        this.Roles = string.Join(",", roles.Select(r => Enum.GetName(r.GetType(), r)));

below is my controller with decoration

    public ActionResult CreateEmployees()
        return View();

and my enum for role

public enum Role
    Administrator = 1,
    UserWithPrivileges = 2,
    User = 3,

and model

public class UserModel
    public int UserID { get; set; }
    public string Username { get; set; }
    public string Password { get; set; }
    public int Role { get; set; }

see pastie for clear view pastie

links I have viewed in trying to solve this among others but I cant seem to piece it togetherMVC 3 Authorize custom roles

Customized authorization attribute in MVC 4 with Roles

I am working on a web application. I already completed it. But when I gone through security audit, I came to know that I should use membership for, login, password change, creating user, reset password etc.

So I stared using membership. I created a login page and it's working fine. I also got a database in my App_Data folder.

enter image description here

The problem is that I already have a database for my application where I have a user table which is having more fields than the table aspnet_Users. see the image below.

enter image description here

So please suggest me how to implement membership in my web application, as I need more fields in user table,

how to insert data along with my fields with the fields above mentioned in the above image, because I didn't fine any code through using membership. If I could got, I would surely make changes accordingly.

I mean how to merge this database and mine without any code.

Scenario I have overriden the telerik library in order to add addition custom features in the grid. Now there is a scenario in which I have to expose the property(Say ClearFilterMethod) to a grid in which I can specify the name of the method(Say "ClearViewState"). I have created a button event for clearAllFilter in the dll that clears all the filter (the event is not expose to the user, I executes internally).


Now I have to call the method that user will specify in the ClearFilterMethod from with in the button click event.

I have an idea we can use delegate for that but how to do that using delegate I have no idea please guide (This is just a thought). If their is any other solution please guide.

I want to display a particular image on my landing page that I have uploaded through the dragonfly gem.

I am getting following error: param is missing or the value is empty: photo

this is what I have on my landing.html.erb view:

<%= image_tag @photo.1.image.thumb('150x185#').url if @photo.1.image_stored? %>

this is what I have on my pages controller:

class PagesController < ApplicationController

    def landing
        @photo = Photo.find(photo_params)

    def photo_params


How do I pass an id of 1 to my @photo object? I know this might be a newb question but I have spent several hours trying different things and nothing has worked. Thanks!

These are my routes:

  root 'pages#landing'

  match '/home',    to: 'pages#home',    via: 'get'
  match '/about',   to: 'pages#about',     via: 'get'
  match '/gallery',   to: 'pages#gallery',   via: 'get'

  match '/events',   to: 'pages#events',   via: 'get'
  match '/menu',   to: 'pages#menu',   via: 'get'
  match '/testing',   to: 'pages#testing',   via: 'get'
  match '/contacts',     to: 'contacts#new',             via: 'get'
  resources "contacts", only: [:new, :create]
  match '/events',   to: 'pages#mevents',   via: 'get'
  resources "events", only: [:new, :create]

  resources :photos

Is there a "best practice" concerning when to use TABLE and when to use DIV tag's when designing a master page? I am designing a master page with a header and footer and in between I have a menu area to the left and a content area to the right. What would be the best way to design this page?

I've read several stack overflow posts on the subject, and they mention that in the controller you can use $this->getServiceLocator()->get('HttpRenderer') or something similar.

However, I am not able to get the HttpRenderer service, as per the exception thrown belw. What am I doing wrong?

   The application has thrown an exception!
 Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for HttpRenderer
#0 /var/opt/projects/MYAPP/web/module/Application/src/Application/Controller/CronController.php(53): Zend\ServiceManager\ServiceManager->get('HttpRenderer')
#1 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83): Application\Controller\CronController->mailAction()
#2 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#3 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#4 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#5 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#6 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#7 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#8 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#9 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#10 /var/opt/projects/MYAPP/web/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(313): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#11 /var/opt/projects/MYAPP/web/public/index.php(30): Zend\Mvc\Application->run()
#12 {main}

Using the ASP.Net Identity 2 provider model in conjunction with plain Authorize attributes.

Anonymous access is true, Windows authentication is disabled.

HttpRequestBase.IsAuthenticated will return true, how-ever, the HttpRequestBase.LogonUserIdentity will not return the actual ClaimsIdentity but instead an impersonated user (me as I'm running IIS Express locally).

The actual authenticated and returned ClaimsIdentity from the provider is accessible via e.g.

HttpContext.Current.User... and/or System.Threading.Thread.CurrentPrincipal...

Q: Why not via HttpRequestBase.LogonUserIdentity?

I'm having these classes:

public class ProductViewModel
    public IEnumerable<Product> Products { get; set; }


public class Product
    public int ArticeNr { get; set; }
    public string Name { get; set; }


And this view

@model ProductsViewModel

@using (Html.BeginForm("Index", "Home", FormMethod.Post))
<table class="table">

    @foreach (var item in Model.Products) {
                @Html.DisplayFor(modelItem => item.ArticleNr)
                @Html.DisplayFor(modelItem => item.Name)

<input type="submit" value="submit" name="submitButton" />

How can I pass All my values from Model.Products to the Controller? I want all my values in the foreach-loop sent to the controller

My controller is taking ProductsViewModel as parameter. But the values after I post in model.Products is null.

        public ActionResult Index(ProductsViewModel model) //here, model.Products is always null after post

I've a little known problem with PayPal integration. I am using REST API with ASP.NET MVC. Everything is right but I would like to disable (or hide) the shipping address.

I read everywhere that it isn't possible with REST API. Really ?!! Is there another way to do that ? If I pass "null" as ShippingAddress, the user can set his shipping address (not the good solution for my app).

Thank you all in advance!

I have 2 questions related to that:

1) I need to invalidate.AspNet.ApplicationCookie after Adding / Removing some remote user to Role using Asp.Net Identity 2. I Tried to use UpdateSecurityStamp, but since no password or username is changed, SecurityStamp remains same. When I use ApplicationRoleManger I can see that User roles are updated but in User.Identity Claims they stay unchanged.

2) How does .AspNet.ApplicationCookie Validation work and how can I access it?

I was trying to use this code, but with no effect

What is ASP.NET Identity's IUserSecurityStampStore<TUser> interface?

Update: This is my Cookie Auth setting:

 app.UseCookieAuthentication(new CookieAuthenticationOptions
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/Login"),
            Provider = new CookieAuthenticationProvider
                OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
                    validateInterval: TimeSpan.FromSeconds(0),
                    regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)),
                OnApplyRedirect = ctx =>
                    if (!IsApiRequest(ctx.Request))

I can see that user.GenerateUserIdentityAsync(manager) is hitted only on login.

i use sql dependency related code in globa.asax file to detect db change notification. i just start the sql dependency from Application_Start event in global.asax file and also called a function which monitor db table change and send notification. every thing is working fine if application pool is running means at least one user is on our web site and at the same time db table change occur.

suppose when db change occur and at the same time application pool is idle or no visitor is visiting our web site then change detection routine is not getting invoke automatically.

here is the code

protected void Application_Start(Object sender, EventArgs e)
        static SqlDependency dep;
        private static void RegisterNotification()
            string tmpdata = "";
                using (SqlConnection conn = new SqlConnection(connectionString))
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandText = "SELECT ActivityDate FROM [bba-reman].ContentChangeLog";
                    dep = new SqlDependency(cmd);
                    dep.OnChange += new OnChangeEventHandler(OnDataChange);
                    SqlDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                            if (dr[0] != DBNull.Value)
                                tmpdata = dr[0].ToString();



        static void OnDataChange(object sender, SqlNotificationEventArgs e)
            SqlDependency dep = sender as SqlDependency;
            dep.OnChange -= new OnChangeEventHandler(OnDataChange);

        protected void Application_End(Object sender, EventArgs e)

just discuss how could i restructure my routine as a result OnDataChange() will fire if application pool is idle or if no visitor is visiting my web site.

one guy told me very vaguely you are use the thread from the thread poll for the first request. as recycles threads and actions like redirect abort the thread, you need a safer thread to perform your action one. so in application start you should start a background thread to handle the dependency.

so please some one discuss this issue in details as a result my above code should run perfectly when no visitor is visiting our web site any page. thanks

Spring integration program is working nicely, I want to add the ability to shutdown the app via a simple servlet request (will extend this ability with more functionality later).

I have followed this example ( and added the changes to my working integration copy, run the main app via intelliJ however my browser gives 'unable to connect', indeed the controller does not even get called.

netstat -ano | findstr 8080 returns nothing so I guess it's not connecting.

I'm a newbie to Spring and have looked but can't find what I am missing.

Any suggestions?

Env: Spring 4, intelliJ, Windows 7, Java 8, integration working well with activeMQ simple send/receive.