ho to remove parent node?
<test1>1</test1><test2>2</test2><remove><test3>3<test3></remove>
it should be like:
<test1>1</test1><test2>2</test2><test3>3<test3>
ho to remove parent node?
<test1>1</test1><test2>2</test2><remove><test3>3<test3></remove>
it should be like:
<test1>1</test1><test2>2</test2><test3>3<test3>
On our website we are trying to dynamically create a number of <link> tags in our header (creating canonical tags). The original code used HTMLGenericControl to do this but it created a close </link> tag which is no good, I need it to create a self-closing tag (e.g. <link href="xxx" rel="canonical" />. In order to accomplish this I changed the code to use HtmlLink instead. Everything worked fine in our DEV and QA environment but when deployed into PROD we receive the "method not found: 'system.web.ui.htmlcontrols.htmlgenericcontrol' error.
Below is the method we are using.
using System; using System.Collections.Specialized; using System.Web; using System.Web.UI.HtmlControls; using Nlc.Utilities; using Sitecore.Data.Items; /// <summary> /// Returns a link tag (as a HtmlGenericControl) with the specified params as attributes /// </summary> /// <param name="rel"></param> /// <param name="href"></param> /// <returns></returns> //public static HtmlGenericControl GetHtmlLinkTag(string href, string rel = null, string hreflang = null) { public static HtmlLink GetHtmlLinkTag(string href, string rel = null, string hreflang = null) { //var hgc = new HtmlGenericControl("link"); var hgc = new HtmlLink(); if (string.IsNullOrWhiteSpace(href)) return hgc; try { hgc.Attributes.Add("href", href); if (!string.IsNullOrWhiteSpace(rel)) hgc.Attributes.Add("rel", rel); if (!string.IsNullOrWhiteSpace(hreflang)) hgc.Attributes.Add("hreflang", hreflang); } catch { hgc.Dispose(); throw; } return hgc; }
Our server is using the latest version of .NET framework.
Hi To All,
I am working on ASP.NET core recently. I am connecting to WCF web service using connection service extension. I successfully added the reference of my service in my project. The problem is when i am calling a service i am getting following error
ProtocolException: The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1 bytes of the response were: '<'.
I have no knowledge on where i have to change the binding settings in ASP.NET core.
could any one please help me in solving this issue.This would be great helpful for me.
I would like to make a layout page based on the view shown below, with the content in the div with class "form-group" inserted in the resulting content pages. Or better yet, I'd like to make all the values after the "asp-for" and "asp-validation-for" tag helpers variable in each content page. Each content page would also have to contain a different model at the top. All this would help tremendously in my quest to make this a "DRY" project. Any hints?
PROPOSED LAYOUT PAGE: @RenderBody() @{await Html.RenderPartialAsync("_BeginAllPartial").ConfigureAwait(false); }<form asp-area=@ViewBag.Area asp-controller=@ViewBag.Controller asp-action=@ViewBag.Action asp-route-returnurl=@ViewData["ReturnUrl"] method="post" class="form-horizontal"><input type="hidden" asp-for="ID" /> @{await Html.RenderPartialAsync("_FormBeginPartial").ConfigureAwait(false); }<div class="form-group"><div class="form-inline"><label asp-for=@RenderSection("ctrl01Label", required: true) class="control-label col-md-3"></label><input asp-for=@RenderSection("ctrl01Input", required: true) class="form-control col-md-offset-1 col-md-4" autofocus tabindex="10" /></div></div> @{await Html.RenderPartialAsync("_FormEndPartial").ConfigureAwait(false); }</form> @{await Html.RenderPartialAsync("_EndAllPartial").ConfigureAwait(false); } PROPOSED CONTENT PAGE: @model InstructionalMaterialViewModel @Layout="_CreateEditLayout" @section ctrl01Label{"Isbn"} @section ctrl01Input{"Isbn"}
Following is the error I get; I also find it strange that the term "section" didn't Intellisense for me.
An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
/Features/Shared/Lookup/_CreateEditLayout.cshtml
An expression tree may not contain a named argument specification
<label asp-for=@RenderSection("ctrl01Label", required: true) class="control-label col-md-3"></label>
An expression tree may not contain a named argument specification
<input asp-for=@RenderSection("ctrl01Input", required: true) class="form-control col-md-offset-1 col-md-4" autofocus tabindex="10" />
Generated Code
An expression tree may not contain a dynamic operation
#pragma warning restore 199
I have a View Component in _Layout.cshtml. My application has a route of /home/{id}. How can I get the id value in my URL route from the View Component controller?
public class LayoutViewComponent : ViewComponent { public async Task<IViewComponentResult> InvokeAsync() { //how do I get the value of {id} here? return View(); } }
Regards. I use this tag i a view to show form:
<form asp-area="Admin" asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal">
But show only:
<form method="post" class="form-horizontal" action="/Admin">
This code is in a view inside "Admin" area, @Html.BeginForm not works as well. But if i change the name of the controller(Account) works well.
Hello everyone, I have a problem with the trap once the click of a html element "li" in javascript, with the following code when I click on an element "li" of folder 4 is unleashed on the click event also elements parent:
<!doctype html><html lang="it"><head><title>Test click</title></head><body><h1>Test click</h1><p>This is a tree!</p><div id="container"><div id="folderstree"><ul id="myFoldersTree"><li id="root" onClick="folder_click(this.id)"><a href="#">root</a><ul id="myGroupNode1"><li id="node1"><a href="#" class="folder1">Files</a></li></ul><ul id="myGroupNode2"><li id="node2"><a href="#">Nuova_cartella</a></li></ul><ul id="myGroupNode5"><li id="node5" onClick="folder_click(this.id)"><a href="#">Nuova_cartella_4</a><li id="node6" onClick="folder_click(this.id)"><a href="#">prova41</a></li><li id="node7"><a href="#">prova42</a></li><li id="node8"><a href="#">prova43</a></li><li id="node9"><a href="#">prova44</a></li></u></li></ul></li></ul></div></div></body></html><script type="text/javascript"> function folder_click(clicked_id){ alert(clicked_id); } </script>
I have already seen many articles but have not managed to avoid the propagation of the event click at the parents tag.
Please I need to solved with the pure javascript, no other libraries. It's very strange this side effect because the event is associated with the single tag html.
Hello:
I'm using VS 2017 and I'm trying to use ASP .NET Core for building a REST API.
How would I reference a legacy .NET assembly in ASP .NET Core?
I referenced an existing assembly and when I try to create an instance in my Controller, it gives me this error below. Any help on this will be much appreciated.
An unhandled exception occurred while processing the request.
<div class="titleerror">FileNotFoundException: Could not load file or assembly 'SMTP.Net, Version=3.0.1.25, Culture=neutral, PublicKeyToken=986a9aa31056680b'. The system cannot find the file specified.</div>WebApplication1.Controllers.TestController.Welcome(string name, int numTimes)
<div class="vote"> 0down votefavorite<div class="favoritecount"></div> </div> | <div> <div class="post-text" itemprop="text"> I am using a jquery theme in my ASP.NET MVC core Application (angularjs2). Some sections are properly working but some of the plugins are not working. Like own-carousel is not getting the images and displaying anything. I have placed the images folder under angular app folder as well under root project directory but it couldn't work in any case. i am placing some code sample here: please see and suggest. index.component.html <div id="hero"><div id="owl-main" class="owl-carousel owl-inner-nav owl-ui-sm"><div class="item" style="background-image: url('app/assets/images/sliders/slider01.jpg');"><div class="container-fluid"><div class="caption vertical-center text-left"><div class="big-text fadeInDown-1"> Save up to a<span class="big"><span class="sign">$</span>400</span></div><div class="excerpt fadeInDown-2"> on selected laptops<br> & desktop pcs or<br> smartphones</div><div class="small fadeInDown-2"> terms and conditions apply</div><div class="button-holder fadeInDown-3"><a href="single-product.html" class="big le-button ">shop now</a></div></div><!-- /.caption --></div><!-- /.container-fluid --></div><!-- /.item --><div class="item" style="background-image: url('../assets/images/sliders/slider01.jpg');"><div class="container-fluid"><div class="caption vertical-center text-left"><div class="big-text fadeInDown-1"> Want a<span class="big"><span class="sign">$</span>200</span>Discount?</div><div class="excerpt fadeInDown-2"> on selected <br>desktop pcs<br></div><div class="small fadeInDown-2"> terms and conditions apply</div><div class="button-holder fadeInDown-3"><a href="single-product.html" class="big le-button ">shop now</a></div></div><!-- /.caption --></div><!-- /.container-fluid --></div><!-- /.item --></div><!-- /.owl-carousel --></div> Images folder is currently available under app folder in assets folder. and this is parent/master layout which have that plugins <!DOCTYPE html><html><headlang="en"><basehref="/"><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1"><linkhref="node_modules/bootstrap/dist/css/bootstrap.css"rel="stylesheet"/><linkhref="app/app.component.css"rel="stylesheet"/><linkhref="node_modules/assets/css/style.css"rel="stylesheet"/><linkrel="stylesheet"href="node_modules/assets/css/style.css"><linkrel="stylesheet"href="node_modules/assets/css/colors/green.css"><linkrel="stylesheet"href="node_modules/assets/css/owl.carousel.css"><linkrel="stylesheet"href="node_modules/assets/css/owl.transitions.css"><linkrel="stylesheet"href="node_modules/assets/css/animate.min.css"><!-- Fonts --><linkhref='//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800'rel='stylesheet'type='text/css'><!-- Icons/Glyphs --><linkrel="stylesheet"href="node_modules/Cartjs/assets/css/font-awesome.min.css"><!-- Favicon --><linkrel="shortcut icon"href="node_modules/Cartjs/assets/images/favicon.ico"><!-- Polyfill(s) for older browsers --><scriptsrc="node_modules/client/shim.min.js"></script><scriptsrc="node_modules/zone.js/dist/zone.js"></script><scriptsrc="node_modules/reflect-metadata/Reflect.js"></script><scriptsrc="node_modules/systemjs/dist/system.src.js"></script><!-- Configure SystemJS --><scriptsrc="systemjs.config.js"></script><scriptsrc="node_modules/assets/js/jquery.js"></script><scriptsrc="node_modules/assets/js/jquery-migrate-1.2.1.js"></script><scriptsrc="node_modules/bootstrap/dist/js/bootstrap.min.js"></script><scriptsrc="//maps.google.com/maps/api/js?key=AIzaSyDDZJO4F0d17RnFoi1F2qtw4wn6Wcaqxao&sensor=false&language=en"></script><scriptsrc="node_modules/assets/js/gmap3.min.js"></script><scriptsrc="node_modules/assets/js/bootstrap-hover-dropdown.min.js"></script><scriptsrc="node_modules/assets/js/owl.carousel.min.js"></script><scriptsrc="node_modules/assets/js/css_browser_selector.min.js"></script><scriptsrc="node_modules/assets/js/echo.min.js"></script><scriptsrc="node_modules/assets/js/jquery.easing-1.3.min.js"></script><scriptsrc="node_modules/assets/js/bootstrap-slider.min.js"></script><scriptsrc="node_modules/assets/js/jquery.raty.min.js"></script><scriptsrc="node_modules/assets/js/jquery.prettyPhoto.min.js"></script><scriptsrc="node_modules/assets/js/jquery.customSelect.min.js"></script><scriptsrc="node_modules/assets/js/wow.min.js"></script><scriptsrc="node_modules/assets/js/buttons.js"></script><scriptsrc="node_modules/assets/js/scripts.js"></script><!-- End Customizable plugins For Sale Cart Portal --><script>System.import('app').catch(function(err){ console.error(err);});</script></head><body><pm-app>Loading App...</pm-app></body></html> systemjs.config.js </div></div>(function(global){System.config({ paths:{// paths serve as alias'npm:':'node_modules/'},// map tells the System loader where to look for things map:{// our app is within the app folder app:'app',// angular bundles'@angular/core':'npm:@angular/core/bundles/core.umd.js','@angular/common':'npm:@angular/common/bundles/common.umd.js','@angular/compiler':'npm:@angular/compiler/bundles/compiler.umd.js','@angular/platform-browser':'npm:@angular/platform-browser/bundles/platform-browser.umd.js','@angular/platform-browser-dynamic':'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js','@angular/http':'npm:@angular/http/bundles/http.umd.js','@angular/router':'npm:@angular/router/bundles/router.umd.js','@angular/forms':'npm:@angular/forms/bundles/forms.umd.js',// other libraries'rxjs':'npm:rxjs','angular-in-memory-web-api':'npm:angular-in-memory-web-api',},// packages tells the System loader how to load when no filename and/or no extension packages:{ app:{ main:'./main.js', defaultExtension:'js'}, rxjs:{ defaultExtension:'js'},'angular-in-memory-web-api':{ main:'./index.js', defaultExtension:'js'}}});})(this); |
Hello everyone, I have already realized the tree in pure javascript my file system, however, can not handle the expansion and collapse of a node, or rather I would click with the mouse on "+" and "-" to produce expansion and collapse but if I click on the name of the node it must trigger a different action. I would preferto continue usingpure javascript.
Hi, I'm looking for a way how to send emails with translatable content using mailkit in ASP.NET Core.
Is it possible to use XSLT/XML or should I use another solution?
Thanks in advance for any advice !
Hi,
I created a new Asp.Net Core Web App.
The app is running fine from dotnet run command or the .exe
I would debug it directly from Visual Studio with F5 in IISExpress or the .exe
When I press F5, a small Chrome page opens but remains empty.
When I press Ctrl+F5, I get "localhost is currently unable to handle this request."
Any help would be great
txs
-Vince
Hi,
I can't figure how to follow the steps I saw in doc + video:
from (VS 2017 enterprise)
- new Project Asp.net core web application (.Net Core)
- Web Application (Authentication -> Individual)
- F5
Chrome opens and when the process is up, the page is fully blank. Same in Edge
In the folder bin\Debug\netcoreapp1.1, only app dlls are shown (no views or www content)
When I publish it, all dotnet dlls + www + views + app dlls are display and site is working
only way to debug is to attach process but it's long and painful to develop and debug
Even if I modify the csproj to copy the missing content, it's not working
<PropertyGroup><TargetFramework>netcoreapp1.1</TargetFramework><PreserveCompilationContext>true</PreserveCompilationContext><EnableDefaultContentItems>false</EnableDefaultContentItems></PropertyGroup>
<ItemGroup><None Update="wwwroot\**\*;Views\**\*;Areas\**\Views;appsettings.json"><CopyToOutputDirectory>Always</CopyToOutputDirectory><CopyToPublishDirectory>Always</CopyToPublishDirectory></None></ItemGroup>
Any help ?
Txs
-v
Hi ,
I created one asp.net core project using .net core sdk 1.1 and when tried to open that using VS 2015 getting below mentioned error, could someone please help me with this..
"the default xml namespace of the project must be the msbuild xml namespace..."
I have an Asp.Net Core application that I have run as a service. I could also run it as an exe, but it leaves the black command window up while it is running. Ideally I would like to have it run minimized in the system tray with a notify icon that they could right click on to close it or stop it. Is this possible in Asp.Net Core? Thank you!
I have a model including two different dates. Both these dates are set up similar to each other in the model.
[Required] [Display(Name = "Booking Date")] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:D}")] public DateTime BookingDate { get; set; } .... [Display(Name = "Invoice Date")] [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:D}")] public DateTime? InvoiceDate { get; set; }
I have then created a view component, including these dates.
public IViewComponentResult Invoke(int id) { var jobs = from j in ctx.Job .Include(j => j.Site) .Include(j => j.WaterBody) .Where(j => j.Site.SiteID == id && j.InvoiceDate != null) .OrderByDescending(j => j.BookingDate) .Take(6) select j; return View(jobs); }
I assume the rest of the view component isn't relevant.
Then in the default view I have:
@foreach (var j in Model) {<tr><td> @j.BookingDate.ToString("dd MM yyyy")</td><td> @j.JobDescription.Substring(0, Math.Min(j.JobDescription.Length, 38))</td><td> @j.InvoiceDate</td><td><a asp-controller="Jobs" asp-action="Details" asp-route-id="@j.JobID">More Details</a></td></tr> }
All I want to do is format Invoice date the same as Booking Date. However every time I try it is throwing an error. It makes no sense. Why would one take the ToString Argument happily and the other refuse it? How can I get this date to play along? Why am I having to format the dates at all given they are formatted already in the Model?
Hello to all, i have a list of objects contain information on file including the path and I thought to provide a javascript json string, unfortunately the paths within the string after creating
the server side (asp.net mvc core) with c # they have doubled backslash character and is not due to the fact that '\' is an escape character. I've tried everything, for example:
string json = Newtonsoft.Json.JsonConvert.SerializeObject(folderTree, Newtonsoft.Json.Formatting.Indented); json = json.Replace ("\\\\", "\\") or json = json.Replace ("\\", "")
i have this :
[{"id":"0","parent":"#","text":"server","level":0,"folderName":"server","folderPath":"Z:\\csi\\server","fileItems":[{"fileName":"serverfile1","filePath":"Z:\\csi\\server\\serverfile1.txt","fileExtension":".txt"},"fileName":"serverfile2","filePath":"Z:\\csi\\server\\serverfile2.txt","fileExtension":".txt"}, {"fileName":"serverfile3","filePath":"Z:\\csi\\server\\serverfile3.txt","fileExtension":".txt"}] }]
I need this :
[{"id":"0","parent":"#","text":"server","level":0,"folderName":"server","folderPath":"Z:\csi\server","fileItems":[{"fileName":"serverfile1","filePath":"Z:\csi\server\serverfile1.txt","fileExtension":".txt"},"fileName":"serverfile2","filePath":"Z:\csi\server\serverfile2.txt","fileExtension":".txt"},
{"fileName":"serverfile3","filePath":"Z:\csi\server\serverfile3.txt","fileExtension":".txt"}] }]
I want to add a variable at the end of each Response .
So in the base page handler i written some thing like this
protected override void OnPreRenderComplete(EventArgs e) { base.OnPreRenderComplete(e); Response.Write(String.Format("<script> var reqId=\"{0}\"</script>", "cgAAAF66S8U0gNQI"); }
The variable is appended at the beginning of the response. when it renders on the browser , chrome reporting as
This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar
How i can append that to response stream so that it renders properly on to the browser. MY application is build on asp.net
I Don't user server side controls. All my controls are client side. I tried some this like this
In the OnloadComplete I didn't see any thing in the source code in the browser.
protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
Page.ClientScript.RegisterClientScriptBlock(GetType(), "reqIdScriptq", string.Format("var reqIqd=\"{0}\"", "cgAAAF66S8U0gNQI"), true);
ClientScript.RegisterHiddenField("abc", "def");
}
I would like to parse my JSON file which contains kay-value pairs and replace tags in my HTML.
So the API gets a JSON file e.g.:
{"myValue1": "value1","myValue2": "value2","myValue3": "value3", }
and I get a HTML template from DB like:
<!DOCTYPE html><html><head><meta charset=utf-8 /><meta name="description" content="description"><title>Page Title</title><link rel="stylesheet" media="screen" href="css/styles.css" /><link rel="stylesheet" media="print" href="css/print.css" /><style> body {background:#e3e3e3;}</style></head><body><p style="color: red;">{{myValue1}}</p><p>{{myValue2}}</p><p>{{myValue3}}</p></body></html>
and I would like to replace all tags from JSON file to HTML file and the result should looks like:
<!DOCTYPE html><html><head><meta charset=utf-8 /><meta name="description" content="description"><title>Page Title</title><link rel="stylesheet" media="screen" href="css/styles.css" /><link rel="stylesheet" media="print" href="css/print.css" /><style> body {background:#e3e3e3;}</style></head><body><p style="color: red;">value1</p><p>value2</p><p>value3</p></body></html>
The template should be replaceable and it is stored in DB. How can I do this in ASP.NET Core?
I am new to ASP.NET Core, I need to create a custom grid control,
Can anyone please provide the steps to create a custom control in ASP.NET Core?