### Install Bootstrap 3 Package (.NET Framework)
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v3/getting-started.md
This command is used in a .NET Framework project to install the Bootstrap version 3 package from the official NuGet feed. Ensure you have the NuGet Package Manager console open in Visual Studio.
```powershell
Install-Package Bootstrap -Version 3.3.7
```
--------------------------------
### Install Bootstrap Package (.NET Core via Bower)
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v3/getting-started.md
This command is used in a .NET Core project to install the Bootstrap package using Bower. After installation, the default location is typically 'wwwroot\lib\bootstrap'. You may need to configure DotVVM to use these paths if they differ from the defaults.
```bash
bower install bootstrap
```
--------------------------------
### Register Bootstrap 4 Configuration in DotVVM
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v4/getting-started.md
Add Bootstrap 4 configuration to the DotvvmStartup.cs file to register all Bootstrap controls under the
```
--------------------------------
### Install DotVVM Electron NuGet Package
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/community-add-ons/dotvvm-electron.md
Install the DotVVM.Framework.Integration.Electron NuGet package required for Electron integration support.
```PowerShell
Install-Package DotVVM.Framework.Integration.Electron
```
--------------------------------
### Configure Custom Bootstrap Resource URLs
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v3/getting-started.md
This C# code snippet shows how to customize the URLs for Bootstrap's CSS and JavaScript files when using DotVVM's resource management. This is useful if your Bootstrap files are located in a non-default path within your project. You pass a DotvvmBootstrapOptions object to AddBootstrapConfiguration.
```csharp
config.AddBootstrapConfiguration(new DotvvmBootstrapOptions()
{
BootstrapCssUrl = "your path to bootstrap.css or bootstrap.min.css",
BootstrapJsUrl = "your path to bootstrap.js or bootstrap.min.js"
});
```
--------------------------------
### Install DotVVM Application Insights for OWIN
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/diagnostics-and-profiling/application-insights.md
Installs the specific DotVVM tracing package for OWIN applications using the Package Manager Console, after Application Insights core packages are set up.
```powershell
Install-Package DotVVM.Tracing.ApplicationInsights.Owin
```
--------------------------------
### Install Swashbuckle NuGet Package for ASP.NET Core
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/respond-to-user-actions/rest-api-bindings/provide-api-metadata.md
Install the DotVVM.Api.Swashbuckle.AspNetCore NuGet package to enable DotVVM integration with Swashbuckle in ASP.NET Core projects. Optionally install Swashbuckle.AspNetCore.Newtonsoft for projects using Newtonsoft.Json serializer.
```powershell
Install-Package DotVVM.Api.Swashbuckle.AspNetCore
# optional - install only if you are using Newtonsoft.Json
Install-Package Swashbuckle.AspNetCore.Newtonsoft
```
--------------------------------
### Install DotVVM.DynamicData NuGet Package
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/community-add-ons/dotvvm-dynamic-data.md
Command to install the DotVVM.DynamicData NuGet package into a DotVVM project using the .NET CLI or Package Manager Console. This is the first step to enable dynamic data features.
```bash
Install-Package DotVVM.DynamicData
```
--------------------------------
### Install Swashbuckle NuGet Package for OWIN
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/respond-to-user-actions/rest-api-bindings/provide-api-metadata.md
Install the DotVVM.Api.Swashbuckle.Owin NuGet package to enable DotVVM integration with Swashbuckle in classic ASP.NET Web API projects using OWIN.
```powershell
Install-Package DotVVM.Api.Swashbuckle.Owin
```
--------------------------------
### Install Application Insights for OWIN
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/diagnostics-and-profiling/application-insights.md
Installs the OWIN extensions for Application Insights via the Package Manager Console. This is a prerequisite for integrating DotVVM's OWIN tracing.
```powershell
Install-Package ApplicationInsights.OwinExtensions
```
--------------------------------
### Create DotVVM project directory and navigate
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/quick-starts/build/create-new-project.md
Creates a new directory for the DotVVM application and navigates into it using command line operations. This prepares the location for project initialization.
```shell
mkdir SampleDotvvmApp
cd SampleDotvvmApp
```
--------------------------------
### Create Control Sample Structure in DotVVM Docs
Source: https://context7.com/riganti/dotvvm-docs/llms.txt
Demonstrates the directory and file structure for adding new control samples to DotVVM documentation. Includes creating a sample directory, sample.json configuration file, and sample.md description file. This structure organizes control examples for documentation purposes.
```json
{
"files": [
{ "name": "page.dothtml" },
{ "name": "ViewModel.cs" }
]
}
```
--------------------------------
### Configure DotVVM Application Settings
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/configuration/overview.md
The `DotvvmStartup` class implements `IDotvvmStartup` and `IDotvvmServiceConfigurator` to set up routes, controls, resources, and services. The `Configure` method handles application-level setup, while `ConfigureServices` registers DotVVM services. Avoid non-essential registrations in `Configure` as it runs during build.
```csharp
public class DotvvmStartup : IDotvvmStartup, IDotvvmServiceConfigurator
{
// IDotvvmStartup implementation
public void Configure(DotvvmConfiguration config, string applicationPath)
{
ConfigureRoutes(config, applicationPath);
ConfigureControls(config, applicationPath);
ConfigureResources(config, applicationPath);
}
private void ConfigureRoutes(DotvvmConfiguration config, string applicationPath)
{
config.RouteTable.Add("Default", "", "Views/default.dothtml");
// Uncomment the following line to auto-register all dothtml files in the Views folder
// config.RouteTable.AutoDiscoverRoutes(new DefaultRouteStrategy(config));
}
private void ConfigureControls(DotvvmConfiguration config, string applicationPath)
{
// register code-only controls and markup controls
config.Markup.AddCodeControls("cc", typeof(MyCustomControl));
}
private void ConfigureResources(DotvvmConfiguration config, string applicationPath)
{
// register custom resources and adjust paths to the built-in resources
config.Resources.Register("myscript", new ScriptResource()
{
Location = new FileResourceLocation("~/wwwroot/Scripts/myscript.js")
});
}
// IDotvvmServiceConfigurator implementation
public void ConfigureServices(IDotvvmServiceCollection services)
{
// configure all DotVVM-related services
services.AddDefaultTempStorages("Temp");
}
}
```
--------------------------------
### DotvvmStartup Class Configuration
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/_migrate/how-to-start-existing-app-owin.md
Define the DotvvmStartup class to configure DotVVM settings, such as registering routes, controls, and resources. It also handles service configuration, like adding temporary storage providers. This class implements `IDotvvmStartup` and `IDotvvmServiceConfigurator`.
```csharp
using DotVVM.Framework;
using DotVVM.Framework.Configuration;
using DotVVM.Framework.ResourceManagement;
using DotVVM.Framework.Routing;
namespace DotvvmDemo
{
public class DotvvmStartup : IDotvvmStartup, IDotvvmServiceConfigurator
{
public void ConfigureServices(IDotvvmServiceCollection services)
{
services.AddDefaultTempStorages("Temp");
}
public void Configure(DotvvmConfiguration config, string applicationPath)
{
// register your routes, controls and resources here
}
}
}
```
--------------------------------
### Disable Automatic Bootstrap Resource Inclusion
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v3/getting-started.md
This C# code snippet configures DotVVM to not automatically include Bootstrap's CSS and JavaScript resources. This option is recommended when you are managing Bootstrap resources manually within your HTML pages, for example, when using a Bootstrap template that already provides these files.
```csharp
config.AddBootstrapConfiguration(new DotvvmBootstrapOptions()
{
IncludeBootstrapResourcesInPage = false
});
```
--------------------------------
### Set Export Start Address
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/business-pack/exporting-data.md
Specifies the starting cell (row and column) for the exported GridView data. This is useful for positioning the table within the worksheet, for example, to leave space for a title above it, using '.WithStartAddress(row, column)'.
```CSHARP
var settings = GridViewExportExcelSettings.Default
.WithStartAddress(3, 1);
```
--------------------------------
### Install Rollup.js and Plugins
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/client-side-development/js-directive/use-typescript-to-declare-modules.md
Installs Rollup.js and essential plugins for bundling JavaScript modules, including CommonJS and Node.js module support, Terser for minification, and Rollup's TypeScript plugin. This setup is recommended for bundling multiple JavaScript files into a single efficient file.
```bash
npm install --save-dev rollup rollup-plugin-commonjs rollup-plugin-node-resolve rollup-plugin-terser @rollup/plugin-typescript
```
--------------------------------
### Disable jQuery Resource in DotVVM Bootstrap Configuration
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v4/getting-started.md
Configure DotVVM to exclude the default jQuery resource from being rendered when you are providing your own jQuery library or have already included it separately.
```csharp
config.AddBootstrap4Configuration(new DotvvmBootstrapOptions()
{
IncludeJQueryResourceInPage = false
});
```
--------------------------------
### Disable Bootstrap Resources in DotVVM Configuration
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v4/getting-started.md
Configure DotVVM to exclude default Bootstrap CSS and JavaScript resources when you have already included them manually in your page header or master page. This prevents duplicate resource loading.
```csharp
config.AddBootstrap4Configuration(new DotvvmBootstrapOptions()
{
IncludeBootstrapResourcesInPage = false
});
```
--------------------------------
### Disable Automatic jQuery Resource Inclusion
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v3/getting-started.md
This C# code snippet instructs DotVVM not to automatically include the jQuery library. Use this option if you are manually including jQuery in your page or if your project does not require it for Bootstrap functionality.
```csharp
config.AddBootstrapConfiguration(new DotvvmBootstrapOptions()
{
IncludeJQueryResourceInPage = false
});
```
--------------------------------
### Configure Custom Bootstrap and jQuery Resources in DotVVM
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v4/getting-started.md
Specify custom resource locations for Bootstrap CSS, Bootstrap JavaScript, and jQuery libraries in DotVVM. This allows you to use custom versions of these libraries instead of the default ones included with the Bootstrap for DotVVM package.
```csharp
var options = new DotvvmBootstrapOptions()
{
BootstrapJsResource = new ScriptResource(new UrlResourceLocation("PATH TO CUSTOM BOOTSTRAP.JS")),
BootstrapCssResource = new StylesheetResource(new UrlResourceLocation("PATH OT CUSTOM BOOTSTRAP.CSS")),
JQueryResource = new ScriptResource(new UrlResourceLocation("PATH TO CUSTOM JQUERY.JS")),
IncludeBootstrapResourcesInPage = true,
IncludeJQueryResourceInPage = true
};
//var options = DotvvmBootstrapOptions.CreateDefaultSettings();
//options.BootstrapJsResource = new ScriptResource(new UrlResourceLocation("PATH TO CUSTOM BOOTSTRAP.JS"));
// bootstrap configuration
config.AddBootstrap4Configuration(options);
```
--------------------------------
### Configure Custom jQuery URL
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v3/getting-started.md
This C# code snippet demonstrates how to specify a custom URL for the jQuery library when integrating Bootstrap with DotVVM. DotVVM automatically includes jQuery if it's required by Bootstrap, and this option allows you to point to your specific jQuery file.
```csharp
config.AddBootstrapConfiguration(new DotvvmBootstrapOptions()
{
...
JQueryUrl = "your path to jquery.x.x.x.js or jquery.x.x.x.min.js"
});
```
--------------------------------
### View Sample Configuration (JSON)
Source: https://context7.com/riganti/dotvvm-docs/llms.txt
Shows the JSON configuration file for a control sample, specifying the associated view and viewmodel files.
```json
# View sample configuration
cat Controls/builtin/Button/sample1/sample.json
# Output:
# {
# "files": [
# { "name": "page.dothtml" },
# { "name": "ViewModel.cs" }
# ]
# }
```
--------------------------------
### Configure MiniProfiler for OWIN
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/diagnostics-and-profiling/miniprofiler.md
This section outlines the process for integrating MiniProfiler with DotVVM in OWIN-based applications. It includes installing the required NuGet packages, enabling MiniProfiler event tracing within DotVVM's service configuration, and provides examples of changing MiniProfiler's default settings.
```powershell
Install-Package MiniProfiler
Install-Package DotVVM.Tracing.MiniProfiler.Owin
```
```csharp
public void ConfigureServices(IDotvvmServiceCollection options)
{
options.AddMiniProfilerEventTracing();
}
```
```csharp
StackExchange.Profiling.MiniProfiler.Settings.RouteBasePath = "~/profiler";
StackExchange.Profiling.MiniProfiler.Settings.Results_List_Authorize = (r) => true;
```
--------------------------------
### Implement IDotvvmServiceConfigurator in DotvvmStartup
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/upgrading-from-older-versions/from-1-1-to-2-0.md
Shows how to make the `DotvvmStartup.cs` class implement the `IDotvvmServiceConfigurator` interface and move DotVVM-specific service registrations into the `ConfigureServices` method. This ensures proper initialization of DotVVM services.
```csharp
public class DotvvmStartup : IDotvvmStartup, IDotvvmServiceConfigurator
{
...
public void ConfigureServices(IDotvvmServiceCollection options)
{
// paste the body of the lambda here
options.AddDefaultTempStorages("Temp");
}
}
```
--------------------------------
### Generated HTML with Command Binding (JavaScript)
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/respond-to-user-actions/commands.md
Illustrates the HTML output generated by DotVVM when a command binding is used. It shows how the `onclick` attribute is populated with JavaScript that calls DotVVM's `dotvvm.postBack` function to initiate a server request.
```html
```
--------------------------------
### Customize Bootstrap 5 CSS Variables
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/bootstrap-for-dotvvm/v5/getting-started.md
This CSS code demonstrates how to override default Bootstrap 5 variables to customize the appearance of your application. You can modify global variables like font size or specific component variables such as accordion button backgrounds. Use `!important` judiciously for specific overrides.
```css
/* Override global variable */
body {
--bs-body-font-size: 2rem;
}
/* Override accordion variable */
.accordion-button:not(.collapsed) {
--bs-accordion-active-bg: #00ff90 !important;
}
```
--------------------------------
### Initialize dotvvm-electron Module in main.js
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/community-add-ons/dotvvm-electron.md
Require and initialize the dotvvm-electron module in the main.js/index.js startup script, specifying the relative path to the web app directory and optional configuration parameters.
```JavaScript
var dotvvmElectron = require('dotvvm-electron');
dotvvmElectron.run(__dirname, {
relativeWebAppPath: 'webapp/dist/app',
});
```
--------------------------------
### Install TypeScript globally
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/concepts/client-side-development/typescript-declarations.md
Install TypeScript CLI tool globally to enable the tsc command for compiling TypeScript files. Verify installation by running tsc --version in the command-line.
```bash
npm install -g typescript
```
--------------------------------
### View Repository File Structure (Bash)
Source: https://context7.com/riganti/dotvvm-docs/llms.txt
Lists the main directories and files in the DotVVM documentation repository, showing the organization for controls, pages, and configuration.
```bash
# View the main structure
ls -la
# Output:
# .gitignore
# .vscode/
# Controls/ # Control reference documentation
# GUIDE.md # Documentation writing guidelines
# LICENSE
# Pages/ # Tutorial and concept pages
# README.md
# __wiki__/
# context7.json # Project metadata
# menu.xml # Navigation menu structure
# Explore control categories
ls -la Controls/
# Output includes:
# bootstrap/ # Bootstrap for DotVVM controls
# builtin/ # Built-in DotVVM framework controls
# View tutorial categories
ls -la Pages/
# Output includes:
# bootstrap-for-dotvvm/
# business-pack/
# concepts/ # Core framework concepts
# dotvvm-for-visual-studio/
# introduction.md
# quick-starts/
# upgrading-from-older-versions/
```
--------------------------------
### Add Electron Integration Services in Startup
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/community-add-ons/dotvvm-electron.md
Configure Electron integration services in the ConfigureServices method of the Startup class using the AddElectronIntegration extension method.
```C#
services.AddElectronIntegration();
```
--------------------------------
### Install DotVVM.AspNetCore NuGet Package
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/quick-starts/modernize/add-dotvvm-to-existing-app.md
Install the DotVVM.AspNetCore NuGet package using Package Manager Console in an existing ASP.NET Core project. This command also installs dependent packages DotVVM.Framework and DotVVM.Core.
```powershell
Install-Package DotVVM.AspNetCore
```
--------------------------------
### Explore Control Documentation Structure (Bash)
Source: https://context7.com/riganti/dotvvm-docs/llms.txt
Demonstrates how to navigate and find files within a specific control's documentation directory, including markdown, view, and viewmodel files.
```bash
# Navigate to a control directory
find Controls/builtin/Button -type f
# Output:
# Controls/builtin/Button/control.md
# Controls/builtin/Button/sample1/page.dothtml
# Controls/builtin/Button/sample1/ViewModel.cs
# Controls/builtin/Button/sample1/sample.json
# Controls/builtin/Button/sample1/sample.md
# Controls/builtin/Button/sample2/...
```
--------------------------------
### Move DotVVM Service Registration to DotvvmStartup (OWIN)
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/upgrading-from-older-versions/from-1-1-to-2-0.md
Demonstrates moving DotVVM service registration from the `Startup.cs` `UseDotVVM` lambda to the `DotvvmStartup.cs` `ConfigureServices` method for OWIN applications. This change is necessary due to updates in the DotVVM Compiler.
```csharp
// DotVVM 1.1
var config = app.UseDotVVM(ApplicationPhysicalPath, options =>
{
// copy the body of the lambda and remove it
options.AddDefaultTempStorages("Temp");
});
// DotVVM 2.0
var config = app.UseDotVVM(ApplicationPhysicalPath);
```
--------------------------------
### Register DotVVM Middleware in OWIN Startup
Source: https://github.com/riganti/dotvvm-docs/blob/4.0/Pages/_migrate/how-to-start-existing-app-owin.md
Register the DotVVM middleware within your OWIN startup class to initialize DotVVM. This involves using the `app.UseDotVVM` extension method, passing your custom DotvvmStartup class and application path. The `IsDebug` method helps conditionally enable debug mode.
```csharp
using System.Web.Hosting;
using Microsoft.Owin;
using Owin;
using DotVVM.Framework;
[assembly: OwinStartup(typeof(DotvvmDemo.Startup))]
namespace DotvvmDemo
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
// initialize DotVVM
var applicationPhysicalPath = HostingEnvironment.ApplicationPhysicalPath;
var dotvvmConfiguration = app.UseDotVVM(applicationPhysicalPath, debug: IsDebug());
}
private bool IsDebug()
{
#if DEBUG
return true;
#endif
return false;
}
}
}
```