Skip to main content

Questions tagged [tagbuilder]

The tag has no usage guidance.

tagbuilder
2 votes
3 answers
685 views

How to migrate usage of StringBuilder+TagBuilder for HTML rendering?

I am migrating projects from .NET Framework to .NET core. This question is about ASP MVC projects. I have a lot of HtmlHelper extension methods and many of these use the TagBuilder class to generate ...
SandRock's user avatar
  • 5,443
0 votes
1 answer
723 views

c# .net core TagBuilder It doesn't show the tag part

I want to print my table in the infinite category system to my cshtml screen with tagbuilder. writes some of it. some of it is not written. please help me. c# codes: public IActionResult Index() ...
maria's user avatar
  • 57
0 votes
1 answer
407 views

How to build an HTML table based on nested Lists of data structure?

I have a nested list structure as follows: class Person { public string Name; public List<Person> Children; public int RowSpan { get { int childrenCount = 0; /*...
Ahmad's user avatar
  • 12.5k
0 votes
0 answers
313 views

How to add HTML attribute without attribute name using TagBuilder?

I am building a Input tag using TagBuilder. I want to build the input tag like below <input name="IsOkay" type="checkbox" {% if MyObject.IsOkay == true %} checked="checked&...
LP13's user avatar
  • 33.1k
0 votes
1 answer
696 views

Add CSS Class to All Tags in TagBuilder, Edit Existing Attribute

How do I go through all the Tags in a Tagbuilder, both All Outer and Inner Elements, and Append "test" to their CSS class . tagbuilder.AddCssClass("test"); Is there a way to loop through all ...
user avatar
0 votes
1 answer
491 views

TagBuilder AddCssClass Order, Adds to Beginning, how to Add New Class at the End?

I noticed Tagbuilder AddCssClass adds tags to the Beginning. How do I make it add it to the end. TagBuilder test = new TagBuilder("div"); toolset.AddCssClass("Number1"); toolset.AddCssClass("Number2")...
jerrythomas38's user avatar
0 votes
2 answers
4k views

Net Core: How to Convert TagBuilder to String in C#?

Is there a native way to convert Tagbuilder to String in Net Core? This only is for ASP Net 5. Convert IHtmlContent/TagBuilder to string in C# Convert value of TagBuilder into a String I think ...
jerrythomas38's user avatar
0 votes
1 answer
667 views

C# Tag builder add attribute without value, need to disable the checkbox

I am trying to generate input checkbox html using Tag Builder in C#, however, searched everywhere and can't seem to add the disabled field to it, as it doesn't allow the value of the attribute to be ...
Ohhh's user avatar
  • 425
0 votes
1 answer
362 views

TagHelper child tag unescaped attribute value

No matter how I try to skin it, I can't get the output from my TagHelper for the Google Analytics onclick attribute to not be escaped. Specifically the single quotes. TagBuilder listTag = new ...
Ashley Bye's user avatar
  • 1,750
1 vote
2 answers
914 views

converting string builder to tagbuilder asp.net mvc 4

I am building an HTML Helper and it does the job, but I am using a StringBuilder class to output the following <div class="panel panel-default"> <div class="panel-heading">The Panel ...
developer9969's user avatar
0 votes
0 answers
227 views

Not able to get correct boolean value from SelectListItem in custom Radio Button

I'm creating a custom radio button helper using tagbuilder. I'm making use of the steps suggested in the post: Custom helper for generating html tags for radio button and associated label , but have ...
Newbie's user avatar
  • 11
2 votes
2 answers
619 views

Asp.NET MVC 6, TagHelper "asp-for" to Model itself

Lets say I have this partial View: @model DateTime? <input asp-for="???" class="form-control" /> What goes to ??? to bind to the Model its self?
Skorunka František's user avatar
2 votes
2 answers
2k views

asp.net MVC6 Implementing a tagbuilder class and get error on ".ToString"

I am getting compile errors when attempting to implement the message class from Levelnis's Blog. The class in question is: using System; using System.Collections.Generic; using System.Linq; using ...
si2030's user avatar
  • 3,975
6 votes
1 answer
3k views

How to load a partialview and store it in a variable to be used in javascript?

I have a prtialview using a model to create a dropdown list. In my main view I create the partialview html string to use it in javascript functions later. View: @model SomeViewModel @{ var ...
Forough's user avatar
  • 262
5 votes
2 answers
2k views

Html.ActionLink extension

I am trying to extend the Html.ActionLink as I want to add a custom meta data for a shared component (in this case a modal). My aim is to further extend the LinkExtensions class within .Net MVC ...
Andy Clark's user avatar
  • 3,463

15 30 50 per page