Sibeesh Passion

Top Menu

  • Home
  • Communities
  • Search
  • About

Main Menu

  • Articles
    • Client Side Technologies
      • JavaScript
      • Angular
      • Node JS
      • JQuery
      • Knockout JS
      • Jasmine Framework
      • Json
      • CSS3
      • HTML5
    • Database
      • SQL
      • MongoDB
      • MySQL
    • Tools
      • IIS
      • Wamp Server
      • WordPress
      • Visual Studio
    • How to
    • Career Advice
    • Interview
    • ASP.NET
    • MVC
    • Azure
    • Web API
    • C#
    • PHP
    • SEO
    • Office Development
  • Product Reviews
    • HighChart
    • High Map
    • Ignite UI
      • igGrid
      • igDataChart
    • JQWidgets
      • JQX Grid
      • JQX List Box
    • Spire.Doc
    • Spire.XLS
  • My Contributions
    • ASP.NET Forum
    • C# Corner
    • Code Project
    • DZone
    • GitHub
    • JSFiddle
    • MSDN
    • Stack Overflow
  • Connect With Me
    • About Me
    • Facebook
    • Google Plus
    • Linkedin
    • Pinterest
    • Twitter
    • Quora
    • YouTube
  • Videos
  • Achievements
    • Awards And Recognitions
    • Community Achievements
  • Authors
    • Andrew Jackson
    • Ashish Ratan Singh
    • Sibeesh Venu
  • Home
  • Communities
  • Search
  • About

logo

Sibeesh Passion

  • Articles
    • Client Side Technologies
      • JavaScript
      • Angular
      • Node JS
      • JQuery
      • Knockout JS
      • Jasmine Framework
      • Json
      • CSS3
      • HTML5
    • Database
      • SQL
      • MongoDB
      • MySQL
    • Tools
      • IIS
      • Wamp Server
      • WordPress
      • Visual Studio
    • How to
    • Career Advice
    • Interview
    • ASP.NET
    • MVC
    • Azure
    • Web API
    • C#
    • PHP
    • SEO
    • Office Development
  • Product Reviews
    • Office 365 Export PST Tool - Great Results with 100% Accuracy

      March 17, 2018
      0
    • Migrate Files From OneDrive to OneDrive for Business by SysTools

      March 17, 2018
      0
    • Data Recovery

      Recover your lost data in any Windows machine easily

      October 12, 2017
      0
    • Ignite_UI_Chart_Control

      Working With IgniteUI Chart igDataChart Control

      July 14, 2016
      0
    • Apply License Key

      Working With IgniteUI Grid Control

      July 10, 2016
      0
    • Grid with check box selection

      Implement radio button selection in JQWidgets JQXGrid using checkbox

      June 29, 2016
      0
    • High Chart

      Client Side Exporting In HighChart

      May 27, 2016
      0
    • Chart Widgets With Server Side Data In MVC Using Angular JS And Web API Output

      Chart Widgets With Server Side Data In MVC Using Angular JS And ...

      March 17, 2016
      0
    • jQuery Datatable With Server Side Data

      jQuery Datatable With Server Side Data

      February 25, 2016
      0
    • HighChart
    • High Map
    • Ignite UI
      • igGrid
      • igDataChart
    • JQWidgets
      • JQX Grid
      • JQX List Box
    • Spire.Doc
    • Spire.XLS
  • My Contributions
    • ASP.NET Forum
    • C# Corner
    • Code Project
    • DZone
    • GitHub
    • JSFiddle
    • MSDN
    • Stack Overflow
  • Connect With Me
    • About Me
    • Facebook
    • Google Plus
    • Linkedin
    • Pinterest
    • Twitter
    • Quora
    • YouTube
  • Videos
    • Video: 21 Easy Tips for Healthy Life

      February 22, 2018
      0
    • Azure Face API

      Webinar: Azure Cognitive Service Face API

      July 23, 2017
      0
    • Custom Stylish Handlebar Mirror in Royal Enfield Thunderbird

      June 25, 2017
      0
    • Wrapping Rope in Royal Enfield Crash Guard Or Bumper

      April 22, 2017
      0
    • How to Change Handlebar in Royal Enfield Thunderbird

      April 22, 2017
      0
    • Video: How to be a successful software engineer

      April 22, 2017
      0
    • Webinar: Why Visual Studio 2017? Few Features of VS2017 You May Love

      April 10, 2017
      0
    • Do You Know A Wow Game Is Already Installed In Your Android ...

      April 6, 2017
      0
    • The Cool New Refactoring and Text Editor Options in VS2017

      April 2, 2017
      2
  • Achievements
    • Awards And Recognitions
    • Community Achievements
  • Authors
    • Andrew Jackson
    • Ashish Ratan Singh
    • Sibeesh Venu
  • Validation Using Template Driven Forms in Angular 5

  • Implement Shared Custom Validator Directive in Angular

  • Implementing Guard in Angular 5 App

  • Creating a Chat Application in Node JS with Express, MongoDB, Mongoose and Socket.io

  • Using MongoDB on Node JS Application Using Mongoose

ArticleMVC
Home›Article›Create And Consume A User Control In MVC

Create And Consume A User Control In MVC

By SibeeshVenu
July 14, 2015
1534
0
Share:

Introduction

In this article we will learn how we can create and consume a user control in MVC. I hope you will like it.

Background

Today I got a requirement of working with CellSetGrid. Since it is supported with our normal Asp.Net web pages alone, I was in a need to convert the same to a user view control and consume it in MVC because my application is in MVC4. I have done the same. So I thought of sharing you that with you all.

Using the code

To do so, You need to follow the following steps.

Add reference to your control DLL

Create And Consume A User Control In MVC

Create And Consume A User Control In MVC

Add new Web User Control

Create And Consume A User Control In MVC

Create And Consume A User Control In MVC

Register your DLL reference

<%@ Register assembly="CellSetGrid2" namespace="OLAPControls" tagprefix="cc1" %>

Place your control

 <div>
        <cc1:CellSetGrid2 id="csg2" runat="server" connectionstring="Data Source="Your DataSource"; Initial Catalog =Your DB Name"
            cube="Your Cube Name" height="800px" width="1500px" />
</div>

Change default namespace

Go to ADODMGrid.ascx.cs from the solution explorer.

Create And Consume A User Control In MVC

Change Namespace System.Web.UI.UserControl to System.Web.Mvc.ViewUserControl

Create Controller

Create And Consume A User Control In MVC

Create a View

Create And Consume A User Control In MVC

Please make sure that you have selected a partial view

Create And Consume A User Control In MVC

Add the User Control to your View

@Html.Partial("ADODMGrid")
@* Here ADODMGrid is our user control name. No need to give its extension (ascx)*@

So here we are add our new web user control to our view.

Add tagPrefix to your Web.Config

Last but the least, you need to add tagPrefix to your web.config file as follows.

 <controls>
        <add tagPrefix="cc1" namespace="OLAPControls" assembly="CellSetGrid2, Culture=neutral, PublicKeyToken=null" />
      </controls>

You need to add teh above code under system.web –> Pages

Now if your your view, you can see your control there 🙂

Conclusion

That is all. I hope you liked this article. Please share me your feedback.

Kindest Regards
Sibeesh Venu

TagsConsume User Controls In MVCCreate Controls in MVCCreate User ControlsMVCMVC ViewRazorUse User Controls In MVCUser Controls
Previous Article

CellSetGrid Implementation in VS 2012 or later

Next Article

How to find PublicKeyToken of a DLL

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

SibeeshVenu

I'm neither an expert nor a guru. I have been awarded Microsoft MVP 2 times , C# Corner MVP 4 times, DZone MVB( Most Valuable Blogger). I always love to learn new technologies, I believe the one who stop learning is old. You are always welcome to ask any doubts if you have any, I would be more than happy to help. Please feel free to follow me on any social media network, I really like to get connected with you.

Related articles More from author

  • LINQ Basic to Advanced Index View
    ArticleASP.NETC#MVC

    LINQ Basic To Advanced – MVC Demo Application

    May 15, 2017
    By SibeeshVenu
  • Dynamic Angular JS Tabs In MVC Figure 1
    AngularArticleCodeProjectHow toMVC

    How To Create Dynamic Angular JS Tabs In MVC

    February 16, 2016
    By SibeeshVenu
  • CRUD_in_MVC_Using_Web_API
    ArticleC#CodeProjectJQueryMVCMVC 4MVC 5Visual Studio 2013Visual Studio 2015Web API

    Load Data From Database Using Web API

    October 31, 2015
    By SibeeshVenu
  • Chart Widgets With Server Side Data In MVC Using Angular JS And Web API Output
    AngularArticleASP.NETC#CodeProjectHighChartHow toMVCWeb API

    Chart Widgets With Server Side Data In MVC Using Angular JS And Web API

    March 17, 2016
    By SibeeshVenu
  • jQuery Datatable With Server Side Data
    AngularArticleASP.NETCodeProjectHow tojQuery DatatablesMVCProductsWeb API

    jQuery Datatable With Server Side Data

    February 25, 2016
    By SibeeshVenu
  • Web API With Angular JS Solution Explorer
    AngularArticleCodeProjectHow toMVCWeb API

    Web API With Angular JS

    February 11, 2016
    By SibeeshVenu

Recommends for you

  • Web API Controller With Async Actions
    ArticleASP.NETC#CodeProjectHow toMVCSQLWeb API

    Web API With HttpClient Or Consume Web API From Console Application

  • Cross_Domain_Data_Sharing_Sender
    ArticleCodeProjectHow to

    Sending data to another domain usign postMessage

  • Ignite_UI_Chart_Control
    ArticleHow toigDataChartIgnite UIProducts

    Working With IgniteUI Chart igDataChart Control

  • Chnage_Element_To_Full_Screen_In_Google_Chrome_Error
    ArticleCodeProjectHow toHTML5JavaScript

    Programmatically Change The Element Or Page Into Full Screen Mode

MICROSOFT MVP (2)

profile for Sibeesh Venu - Microsoft MVP

Stack Overflow

profile for Sibeesh Venu at Stack Overflow, Q&A for professional and enthusiast programmers

C# CORNER MVP

profile for Sibeesh C# Corner - A Social Community of Developers and Programmers

DZONE MVB

profile for Sibeesh Venu - DZone MVB

CODE PROJECT

TIMELINE

  • April 22, 2018

    Validation Using Template Driven Forms in Angular 5

  • April 22, 2018

    Implement Shared Custom Validator Directive in Angular

  • April 21, 2018

    What is SharePoint? Explore its Top 10 Benefits & Advantages

  • April 7, 2018

    What’s the Difference Between OneDrive and Onedrive for Business Win 10

  • March 28, 2018

    How to Fix Exchange Server Dirty Shutdown State Errors

  • March 26, 2018

    Implementing Guard in Angular 5 App

  • March 17, 2018

    Office 365 Export PST Tool – Great Results with 100% Accuracy

  • March 17, 2018

    Migrate Files From OneDrive to OneDrive for Business by SysTools

  • AngularArticleHow to

    Validation Using Template Driven Forms in Angular 5

    Introduction In this post, we are going to see how to do validation using template driven forms in Angular 5, this is just a different approach that you can follow, as ...
  • AngularArticleHow to

    Implement Shared Custom Validator Directive in Angular

    Introduction In this post, we are going to see how to create a custom validator directive in Angular 5. We have already seen how to do validation in our previous ...
  • ArticleSharePoint

    What is SharePoint? Explore its Top 10 Benefits & Advantages

    Introduction In this era of cloud computing and collaborative platform, SharePoint is a familiar name to the people of the business industry. The fact that more than 85% of Fortune ...
  • ArticleMicrosoft WindowsWindows 10

    What’s the Difference Between OneDrive and Onedrive for Business Win 10

    Introduction Unless you are completely ignorant of cloud technology, you must have heard of the term OneDrive. These days we also hear about OneDrive for Business (ODfB). Some people even ...
  • Article

    How to Fix Exchange Server Dirty Shutdown State Errors

    Introduction About Dirty Shutdown State Error Microsoft Exchange Server database works with Extensible Storage Engine (ESE), which is also known as the JET engine at the core. This Jet engine ...

Archives

  • April 2018
  • March 2018
  • February 2018
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • December 2016
  • November 2016
  • October 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • January 2015
  • December 2014
  • November 2014
  • October 2014
  • August 2014
  • December 2013

Recent Posts

  • Validation Using Template Driven Forms in Angular 5
  • Implement Shared Custom Validator Directive in Angular
  • What is SharePoint? Explore its Top 10 Benefits & Advantages
  • What’s the Difference Between OneDrive and Onedrive for Business Win 10
  • How to Fix Exchange Server Dirty Shutdown State Errors
  • Implementing Guard in Angular 5 App
  • Office 365 Export PST Tool – Great Results with 100% Accuracy
  • Migrate Files From OneDrive to OneDrive for Business by SysTools
  • Continue With Learning Indexes in MongoDB
  • Learn MongoDB With Me – Part 2
  • Video: 21 Easy Tips for Healthy Life
  • Learn MongoDB With Me
  • Why Office 365 Calendar Permissions Not Working- Solution
  • SQL Log File Corruption and Possible Recovery Methods
  • Creating a Chat Application in Node JS with Express, MongoDB, Mongoose and Socket.io

ABOUT ME

I am Sibeesh Venu, an engineer by profession and writer by passion. I’m neither an expert nor a guru. I have been awarded Microsoft MVP, C# Corner MVP, DZone MVB. My hobbies are reading, writing, blogging and riding my Royal Enfield Thunderbird.

Sibeesh Passion is a non-profit organization which is created for sharing knowledge and widen our thoughts. You are welcome to be a part of it.

CONTACT ME

  • X 384 / A, Katrikkal House, Vembilly Post, Kunnathunadu Panchayat, Ernakulam - 683565, Kerala, India
  • 08893 08893 2
  • info@sibeeshpassion.com

TAG CLOUD

Achievements ADOMD Angular Angular 5 Angular JS article Article Of The Day Asp.Net Azure C# c-sharp corner Career Advice chart code snippet CSharp CSS CSS3 Database HighChart How To HTML5 HTML5 Chart Interview Javascript JQuery jquery functions JQWidgets JQX Grid Json Microsoft MongoDB MVC News Node JS Products Royal Enfield SQL SQL Server Visual Studio Visual Studio 2017 VS2017 Web API Windows Windows 10 Wordpress

Follow Me

HOW MAY I HELP YOU

  • Home
  • About
  • Communities
  • Search
© Copyright Sibeesh Passion 2018-2019. All Rights Reserved.