htmlhelper

Proper way of building MVC ActionLink

I've got an MVC ActionLink like so (which works just fine) <%: Html.ActionLink(user.UserName, "Details", "Users", New With{.id = user.ID, .slug = Replace(user.UserName," ","-")}, nothing)%> But since it's not "recommended" to do string manipulation in the View, I'm wondering how I could build a custom Html ActionLink to do the string ...

Is it possible to use SandCastle with Visual Studio 2008 and C++ (non-CLI)?

Hi, I'm mystified: I'm using Visual Studio 2008 with C++ (non-CLI), and I can't for the life of me work out how to build the help file with Sandcastle. Once its installed, and its generating an .xml file, shouldn't there be a menu option somewhere to switch on the build of the docs? Or at least a menu option to trigger the build of the...

Is this overkill, or good use of CakePHP's HTML helper?

I just reformatted the default layout of my CakePHP application. I eliminated as much in-line html as possible by putting almost everything inside the html helper methods. It was fun, but I'm wondering what benefit I've gained from this exercise, if any? <?php $output = implode("\n", array( $html->docType(), $html-...

html helper takes a dictionary<string,object>, how to use this parameter?

If a html helper takes a idictionary as a parameter, how do I use it? I tried: <%= Html.Blah( new { id = "blah" }) %> But that doesn't work. ...

HTML Helper - Reusable View - PHP

Hello.. I am new to PHP and I was hoping someone could help me determine what the best way to go about creating a reusable view would be. What I have is a form that will be used to Add or Edit data. Therefore the view will be identical except in the case of an Edit the form fields will be populated. So I am creating an HTML helper that...

Is a Strongly Typed Html.Telerik().DatePicker() possible in ASP.NET MVC in a Html.BeginForm()?

I have a section of a view that I would like to submit to an action so it is setup inside a Html.BeginForm() I am trying to also make use of the Html.Telerik().DatePicker() control and would like it also to strongly type linked inside the form, same as the DropDownListFor, is this possible? <% using (Html.BeginForm("MyAction", "Respond...

Is it better practice to use a few tag builders or a StringBuilder to generate an Object tag? ASP.NET MVC

Hello SO: I wrote an HTML helper to generate a YouTube embed link. It has 3 parameters, YouTubeID, Width, and Height. I originally wrote it with a StringBuilder, but then I decided to try to use the TagBuilder (well, a few of them). Here are the two different returns: //Tag Builder public static string YouTube(this HtmlHelper helper, ...

How do i get a Request Object outside a controller in asp.net mvc2

Is there a way to get the Request Object in a Html Helper Method. I'd like to know if a file exists to replace non existent Files with a default Image. Therefore i need the Request Object and it's Method MapPath(path). Has anybody an idea. Thx Thomas ...

How to use Using the HtmlAgilityPack to get table value

http://www.dsebd.org/latest_PE_all2_08.php i work on asp.net C# web.Above url contain some information ,i need to save them in my database and also need to save then in specified location as xml format.This url contain a table.I want to get this table value but how to retrieve value from this html table. HtmlWeb htmlWeb = new HtmlWeb...

Spark View Engine with custom HTML Helpers

I've added some of my own helpers to the System.Web.Mvc within my project and got it working with the default asp.net mvc view engine. By defining the helper like namespace System.Web.Mvc { public static class XSSHelper { public static string h(this HtmlHelper helper, string input) { return AntiXss.H...

ASP.NET MVC: Why is `ToMvcHtmlString` not public?

I'm trying to write my own little HTML helper which acts a lot like DropDownListFor but which doesn't suffer from the same problems that I've encountered before. Let's not discuss whether or not DropDownListFor is flawedthat is not what this question is about. Anyways, what is the reason that the MVC guys make ToMvcHtmlString internal a...

Which is the preferred method of starting a form using HTML helpers??

<% using(Html.BeginForm()) { %> ... <% } %> OR <% Html.BeginForm(); %> ... <% Html.EndForm(); %> What are the advantages/disadvantages of using both ways to use Html.BeginForm? ...

ASP.NET MVC: DropDownList -- Of DataSource, SelectedItem, and inline code access within the View

As far as I can tell, there are 3 ways to create a DropDownList in an ASP.NET MVC View: Hand code the HTML manually <asp:DropDownList ID="someID" runat="server"></asp:DropDownList> <%= Html.DropDownList("someID") %> I think we can all agree that #1 is (generally) a waste of time. With #2, it appears to be the "WebForms" way of doing...

How to implement like-HtmlHelper

HtmlHelpers are really useful, also i was using AjaxHelpers untill i wanted to do something they can't... so now i'm prefering jquery+javascript, but i don't like to write in javascript (mayby because i never know it as good as i wanted) and to make life easier i wanted to implement something like JQueryHelper, but right now i don't know...

How to get URL information in C# variable?

http://www.dsebd.org/latest_PE.php The above url contain several information .From this url i just want to get bellow information.How to? Price Earning Ratio : at a glance on Aug 2, 2010 at 11:28:00 I want to know how to get url information into a variable or some storage container in C#.Specific i need above information ,i don't ne...

How to resolve issue with image path when testing HtmlHelper?

I came across an issue when I was testing my HTML Helper. Basically I'm creating a grid with loads of rows, columns and different types of data in it. In the header there is also a image to notify the user what column the data is sorted by. However, when I'm writing my test now (way too late, but better late than never right?!), I get th...

Is a HTML helper a place for Business Logic?

I asked this question earlier about business logic and presentation logic, and it got me thinking.. I think it's easier to spot questionable practice when looking at code in a View because I'm automatically suspicious when I see it. Usually it's ok because it's presentation logic, but I always tend to look closer. But I don't look as cl...

HtmlHelper NameFor method

Is there any Html.NameFor feature already implemented, that get the name html attribute for a model item? I'l like to use the following code in my Razor view: <input type="text" value="@Model.User.Email" name="@Html.NameFor(x => x.User.Email)"> ...

Can you register a controller against multiple URLs in asp.net mvc?

I want to create an MVC application where by I can create areas of a site that use the same functionality but work under a seperate URL. e.g. I want to use the same image gallery controller (type not instance) under two different URLs "/Event1/Gallery" and "ProductInformation/Gallery". However if I register this in the routes table and ...

How to concatenate several MvcHtmlString instances

I have some doubts about how to concatenate MvcHtmlString instances because of this information found in MSDN : MvcHtmlString Class Represents an HTML-encoded string that should not be encoded again Do I risk that strings are HTML-encoded twice when using code like this: var label = Html.LabelFor(model => model.Email); var textb...