We've just updated ASP.NET from Preview 3 to Preview 5 and we've run into a problem with the Html.Image HtmlHelper in our aspx pages.
It seems that Html.Image has moved from System.Web.Mvc into Microsoft.Web.Mvc, and the only way we've found to access the helper now is to add an import statement to every .aspx page that uses it. All the...
I have a strongly-typed MVC View Control which is responsible for the UI where users can create and edit Client items. I'd like them to be able to define the ClientId on creation, but not edit, and this to be reflected in the UI.
To this end, I have the following line:
<%= Html.TextBox("Client.ClientId", ViewData.Model.ClientId, new {...
I'm just in the process of upgrading my Preview 5 application to Beta 1, and I'm nearly there save for this one error when trying to render a control:
'System.Web.Mvc.HtmlHelper' does not
contain a definition for
'RenderPartial' and no extension
method 'RenderPartial' accepting a
first argument of type
'System.Web.Mvc.HtmlH...
I'm interested in seeing what custom extensions other developers have created for the ASP.NET MVC HtmlHelper class.
I think Microsoft got off to a great a start, but as usual, left a lot of open holes to fill!
Looks like I am going to have to create some for rendering images, rendering action links as images, and so on.
Thought ...
I upgraded a large ASP.NET MVC application I've been working on to the latest beta today, and after some initial problems, I've got it mostly working again. The big problem is that I have things like this:
<%= Html.ActionLink("LOGIN", "Index", "Authorization", new { redirect=Request.Url })%>
and
<%= Html.ActionLink("Edit this page"...
I have a html.actionlink that i wish to display a link to a members profile page like this: http://somesite.com/members/{username}
When use the following markup
<%= Html.ActionLink(r.MemberName, "profile", new { MemberName = r.MemberName } )%>
I get a link that looks like this: http://somesite.com/members?MemberName={username}
What ...
Has anyone written any HTMLHelper classes for MVC that help with Yahoo's User Interface Library?
For instance I have written a helper method to convert a 'menu model' into the HTML markup needed to support the Yahoo Menu Control. The MVC pattern works well here because obviously if I chose to switch to a different menu implementation I ...
Hi All,
I create an amount of actions in MVC controllers.
public ActionResult DoSmth1(string token)
public ActionResult DoAnother2(string token)
And when I have to call ActionLink..
=Html.ActionLink<SomeController>( x=> x.DoSmth(item.property), item.property)
=Html.ActionLink<AnotherController>( x=> x.DoAnother(item.property), item....
I am writing my own HtmlHelper extenstion for ASP.NET MVC:
public static string CreateDialogLink (this HtmlHelper htmlHelper, string linkText,
string contentPath)
{
// fix up content path if the user supplied a path beginning with '~'
contentPath = Url.Content(conten...
Just want to confirm that there is no way to extend or replace Html.Image functionality without writing a replacement function.
I want to write a function that will use Amazon's S3 service for hosting images.
The best approach I've come up with is a helper method Html.SmartImage which would check a configuration property to see if i wa...
I think in C# you can create in-line RouteValueDictionary instances like this:
<%=Html.RouteLink(Model.Name, "SomeRoute", new { id = Model.Id }) %>
What's the equivalent in Visual Basic?
This works, but is quite wordy:
<%
Dim d As New RouteValueDictionary()
d.Add("id", Model.Id)
%>
<%=Html.RouteLink(Model.Name, "SomeRoute",...
I am trying to build an HtmlHelper extension in ASP.NET MVC RC2. This code worked fine in Preview 5, but does not work anymore in RC2 and I am trying to understand why. Here is the code:
public static string EmptyDropDownList(this HtmlHelper htmlHelper, string name, object htmlAttributes)
{
return htmlHelper.DropDownList(name, new S...
I've got a single route in my Global.asax.vb page like this...
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute( _
"IdOnly", _
"{id}", _
New With {.controller = "Page", _
.action = "Details", _
...
Possible Duplicate:
ASP.NET MVC Ajax.ActionLink with Image
The Html.RouteLink() HtmlHelper works great for text links. But what's the best way to link an image?
...
When writing an htmlhelper extension if I want to support the similarly structured ctors for my htmlhelper extension method, I use RouteValueDictionary as follows:
public static string ListBoxDict(this HtmlHelper htmlHelper,
string name,
object value,
...
I am just wondering if I have to worry about encoding the values that get output when I use HTML helpers like Html.DropDownList().
If so, how do I encode them? It's easy to do if I were building the drop down manually -- just wrap each value with "Html.Encode()". However, I don't know how to do this when using HTML helpers.
...
I am using the Html.TextBox helper method to generate a textbox against my model but when i pass in an anonymous htmlAttributes class with @class defined like below, the class is never assigned. Am I doing something wrong? I have assigned a readonly attribute the same way and it worked.
<%= Html.TextBox("LastName", Model.LastName, new...
Hi,
is it possible to generate cross-application action links using the HTML helper class?
I have the following (both are separate VS2008 projects):
http://mainwebsite/
http://mainwebsite/application
I would like to generate a link IN the /mainwebsite/application/ project TO /mainwebsite/. Is this possible? Or should I just hardcod...
This error message is driving me nuts.
I'm getting it when using Html.ListBox and Html.DropDownList HtmlHelpers with ASP.NET MVC v1.0. Populating the lists works OK - I can view them, etc - but when I go to create a new record in the Model using the FormCollection passed into the Controller to get the selected value, this error occurs. ...
Hi,
In my view page, I want to link to the action "Display" and pass it the ID that the action expects as a parameter.
Which html helper do I use? I don't want it to create the a href page of the string, just the url.
...