Can I use a spark variable inside an html helper?
Say we have
<var url="Url.Action(“get”)" />
!{Html.Image("~/Content/up.png")}
Now if I need to use the url inside Html.Image as an attribute(part of the 2nd param) to get
<img src="~/Content/up.png" type="~/engine/get" />
how do I go about doing it?
...
I'm pretty new in ASP.NET MVC (about 3 months) and i've the followin issue:
I have a Entity Class called 'Usuario' in a ClassLibrary referenced as 'Core' and, when i create a strongly-typed view and add a html.textboxfor<> like:
<%= Html.TextBoxFor(u => u.Login) %>
it raises the following error:
Error 3 The call is ambiguous bet...
I have build a custom Html Helper extension as follows:
public static string DatePicker(this HtmlHelper helper, string name, string value)
{
return string.Format(@"<script type='text/javascript'>
$(document).ready(function(){{
$('#{0}').datepicker({{
changeMonth: true,
changeYear:true,
dateFormat: ...
I want to override Html.TextBoxFor() with my own helper that has the exact same signature (but a different namespace of course) - is this possible, and if so, how?
The reason for this is that I have 100+ views in an already existing app, and I want to change the behaviour of TextBoxFor so that it outputs a maxLength=n attribute if the p...
In my layout, I have a menu that I've included as an element, and it contains a link like so..
<? $html->link('New Part Number','/part_numbers/add'); ?>
The problem that I have is that cake isn't redirecting correctly and it ends up sending me to "http://localhost/part_numbers/add" instead of "http://localhost/my_client_folder/client_...
What's the correct syntax for an HTML helper (in MVC2) to define an onblur handler where the textbox is generated with code like:
<%=Html.TextBox(
"ChooseOptions.AddCount" + order.ID,
(order.Count > 0) ? AddCount.ToString() : "",
new { @class = "{number: true} small-input" }
)
thx
...
Hi,
It seems that the default ASP.NET MVC2 Html helper generates duplicate HTML IDs when using code like this (EditorTemplates/UserType.ascx):
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<UserType>" %>
<%: Html.RadioButton("", UserType.Primary, Model == UserType.Primary) %>
<%: Html.RadioButton("", UserType.Stand...
I am trying to write an html helper extension within the asp.net mvc framework.
public static MvcHtmlString PlatformNumericTextBoxFor<TModel>(this HtmlHelper instance, TModel model, Expression<Func<TModel,double>> selector)
where TModel : TableServiceEntity
{
var viewModel = new PlatformNumericTextBox();
var...
Hello,
I'm testing some concepts in ASP.NET MVC multisteps (Style Wizards) with a small application which allow me to records organizations in a database.
To make things easier, I've a class OrganizationFormModelView that contains an object of class Organization and a property called ParentOrgList of SelectList type. The only purpose o...
If I use DisplayForModel in a strongly-typed ASP.NET MVC 2 View with an EntityObject model, then unwanted field labels are displayed:
EntityState
EntityKey
How can I control the output to hide these?
...
Hi guys,
I've a little problem with an Html.ListBox.
I am developing a personal blog in ASP.NET MVC 1.0 and I created an adminpanel where I can add and edit a post!
During this two operations, I can add also tags.
I think of use an Html.ListBox() helper to list all tags, and so I can select multiple tags to add in a post! The problem ...
I am writing a dirty little extension method for HtmlHelper so that I can say something like HtmlHelper.WysiwygFor(lambda) and display the CKEditor.
I have this working currently but it seems a bit more cumbersome than I would prefer. I am hoping that there is a more straight forward way of doing this.
Here is what I have so far.
pub...
I am using asp.net mvc to do model binding. When I pass a model to a view I am able to see the model data displayed in the form inside a label
<%= Html.Label(Model.title) %>
<%= Html.Label(Model.description) %>
However I am not able to do the same using
<%= Html.TextArea(Model.description)%>
Is there a syntax difference betwe...
As the question title explains, what is the best way to specify a format which my Views use when displaying values of a DateTime property via the Html.TextboxFor method.
The default display includes the Date and Time where I really only want the Date displayed.
Thanks
...
Ok, maybe the title isn't the most descriptive thing in the world, but this problem is killing me. What I'm trying to do is create an ActionLinkFor helper method, like so:
public ActionResult Index()
{
// Does Stuff
}
public ActionResult SomeAction(int param1)
{
// Does Stuff
}
These are two action methods. Action methods can h...
Hello,
I have a series of pages (in a wizard type application). After collecting user's inputs here and there, I'd like to display a summary in a single page. I don't want the users to modify information on that page, just to visualize them. Otherwise, he they go back to the prevoius pages to do so.
To obtain that, I use Html.Encode(Mo...
Hi,
I'm trying to set focus on a text box which generated in the following way:
<%=Html.TextBoxFor(model => model.Email, new { style = "width:190px;Border:0px", maxsize = 190 })%>
i tried to use javascript which didnt help much.
var txtBox = document.getElementById("Email");
if (txtBox != null) txtBox.focus();
...
Hi all I wanted to allow the users to enter html and links in textbox. How can I achieve something like this in ASP.NET MVC 2? I have something like this now...
<div class="editor-field">
<%= Html.TextAreaFor(model => model.Description) %>
<%= Html.ValidationMessageFor(model => model.Description) %>
</di...
Hey guys,
I have a form partial current setup like this to make new blog posts
<% form_for([@current_user, @post]) do |f| %>
This works great when editing a post, but when creating a new post I get the following error:
undefined method `user_posts_path' for #<ActionView::Base:0x6158104>
My routes are setup as follows:
map.resour...
I've created an Html extension method in Helper class, but I can not get it to work. I've implemented it as seen on different tutorials.
My MenuItemHelper static class:
public static string MenuItem(this HtmlHelper helper, string linkText, string actionName, string controllerName)
{
var currentControllerName = (string)help...