GithubHelp home page GithubHelp logo

devexpress-examples / asp-net-mvc-round-panel-set-content Goto Github PK

View Code? Open in Web Editor NEW
0.0 56.0 0.0 151 KB

Use the SetContent method to define the content of DevExpress MVC extensions.

License: Other

C# 23.45% HTML 61.50% ASP.NET 0.66% Visual Basic .NET 14.38%
dotnet mvc-navigation layout multi-purpose-extensions asp-net-mvc

asp-net-mvc-round-panel-set-content's Introduction

Round Panel for ASP.NET MVC - How to define control content

The SetContent method allows you to define the content of DevExpress MVC extensions. This example demonstrates how to use these method overloads to define RoundPanel content in the following ways:

  • Call the SetContent(String content) method overload to specify the content as a string. This overload is intended for scenarios where it is necessary to render simple HTML content (specified directly as a parameter).
    settings.SetContent(@"<table border=\"1\"><tr><td>RoundPanel Content Here</td></tr></table>");
    
  • Call the SetContent(Action contentMethod) method overload to add a DevExpress MVC Extension in the panel content.
    settings.SetContent(() => {
        Html.DevExpress().Label(lbl => {
            lbl.Name = "lbl";
            lbl.Text = "DevExpress Label - Some Text";
        }).Render();
    });
    
  • Call the ViewContext.Writer.Write method to combine different syntax constructions (raw HTML tags, action methods, built-in HtmlHelper methods, DevExpress MVC Extensions) into a text stream and pass it to the SetContent(String content) method overload.
    settings.SetContent(() => {
        //Raw HTML
        ViewContext.Writer.Write("<table border=\"1\"><tr><td>Content From Raw <b>HTML</b> Table Here...</td></tr></table>");
        ViewContext.Writer.Write("<br/>");
    
        //Action Method
        Html.RenderAction("SeparateAction");
        ViewContext.Writer.Write("<br/>");
        ViewContext.Writer.Write("<br/>");
    
        //Partial View with Html.BeginForm
        Html.RenderPartial("SeparatePartialView");
        ViewContext.Writer.Write("<br/>");
        ViewContext.Writer.Write("<br/>");
    
        //Html Helper
        ViewContext.Writer.Write(Html.TextBox("txtName").ToHtmlString());
        ViewContext.Writer.Write("<br/>");
        ViewContext.Writer.Write("<br/>");
        
        //Conditional
        ViewContext.Writer.Write("Content From Conditional Rendering Block:");
        ViewContext.Writer.Write("<br/>");
        bool condition = DateTime.Now.Year == 2014;
        if(condition) {
            ViewContext.Writer.Write("<b>Condition Passed</b>");
        } else {
            ViewContext.Writer.Write("<b>Condition Failed</b>");
        }
        ViewContext.Writer.Write("<br/>");
        ViewContext.Writer.Write("<br/>");
        
        //DevExpress MVC Extensions
        Html.DevExpress().Label(lbl => {
            lbl.Name = "lbl";
            lbl.Text = "Content From DevExpress Label Here...";
        }).Render();
    });
    

You can use these approaches for every DevExpress MVC Extension that suppors the SetContent or SetNestedContent method.

It is also possible to handle Set{ElementName}TemplateContent methods to define template content.

Files to Review

Documentation

asp-net-mvc-round-panel-set-content's People

Contributors

devexpressexamplebot avatar lanadx avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.