I'm creating an Html TextBox via HtmlHelper and I can't get the value attribute set. I've tried both of the lines below and I have also googled but cannot find a solution:
<%= Html.TextBox("name", null, new { @class = "textbox", value = "hi" }) %>
<%= Html.TextBox("name", null, new { @class = "textbox", @value = "hi" }) %>
Both lines ...
I have some images inside links that I want to essentially look like this:
<a href="/path/to/img.png"><img src="/path/to/img.png" /></a>
Clicking on the link should load the image it contains. I'm trying to use CakePHP's HTML helper to do this, as follows:
<?php
echo $html->link(
$html->image('img.png'),
'img.png',
arra...
ASP .NET MVC 1
I'd like to show a partial view base on a model, and I'd like that to have a fairly short command for that. So I saw a way of using both a HtmlHelper and a controller (And I'd use another controller for that, not the controller currently used).
But somehow it still gives an error, though I think the method starts to look...
I have an HTMLHelper extension method that outputs HTML to Response.Write. How best to unit test this?
I'm considering mocking the HtmlHelper passed into the method, but am unsure as to how I should verify the HTML sent to Response.Write.
Thanks
...
Hi,
I am trying to create a custom HTML Helper that encapsulates some presentation logic because I have to reuse this logic a few times on the same page and maybe in the future.
If the user's address is in North America, then I want two text boxes to be displayed for the telephone number input, one for the area code and the other for t...
Is there a generic Html.Element?
I would like to be able to do this:
Html.Element<AccountController>("IFrame", "elementName", new { src = c => c.ChangePassword })
...
Where to put the helper class in the project folder hierarchy ?
...
I'm sure I'm doing something really stupid, but I've created a Nested Site master for one section of my app.
I got the extra text to show up, like it should on the new Site Master (Greek.Master). But when I went to add some Html to Greek.Master, I found out the html helper isn't working.
Here's my nested master
<%@ Master Language="C...
How does HtmlHelper.ActionLink(htmlhelper,string linktext,string action) figures out correct route?
If i have this=>
HtmlHelper.ActionLink("Edit","Edit")
Mvc automatically finds out correct route.
i.e. - if controller was Product, it will render anchor with href product/edit.
So - how to figure out controller name when i got htmlHe...
I am trying to debug a problem where HtmlHelper is null in extension methods. Oddly the debugger claims it's fully populated, however I consistently get null exceptions. I'm trying to figure out where HtmlHelper should being instantiated in an attempt to see where my problem may be.
Where should HtmlHelper be Instantiated?
Update: I...
Hey,
Something pretty weird is happening with my app:
I have the following property in my ViewModel:
public int? StakeholderId { get; set; }
It gets rendered in a partial view as follows:
<%= Html.Hidden("StakeholderId", Model.StakeholderId) %>
The form is submitted, and the relevant controller action generates an id and updates ...
I read that it's possible, but didn't get idea how.
Any ideas?
...
Basically, the Model is like this:
----------------------------------
| CAT_ID | CAT_NAME | CAT_PARENT |
----------------------------------
which make this a recursive relationship. But how should we use this model in our Asp.net mvc web application with least amount of query. My temporary solution is pass the object in to the functi...
Hi,
What is the best practices for hiding a custom grid or a table or a div and display a "No Records Found" message when there are no records.
I ve come up with this idea
<div class="<%= Html.IsVisible(Model.Count)">
...
..
..
</div
.displayNone {display:none;} .displayInherit {display:inherit;}
public static str...
Hi all,
I have a link to delete action using Jquery dialog confirm message. Clicking on delete link, a modal popup is showing with a confirmation question. Button Yes is triggered to submit the form with id = Model.Id
<td>
<% using (Html.BeginForm<AssessorActionPlanController>(
c => c.Delete(Model.Id), FormMethod.Post, n...
Hi,
I was wondering if it's possible to render an Html Helper in a View inside a codeblock. So instead of:
<% = Html.TextBox("sometextbox", "somethingelse") %>
I want to do:
<%
switch(SomeParameter)
{
case "blah":
Html.TextBox("sometextbox", "somethingelse")
break;
}
%>
And have this render. Of course as it is, it ...
Hi all
I am trying to get through Rob Conery tutorial MVC StoreFront ans I have a problem with a line of code which is a link to a controller action.
<div class="categoryNavigation">
<% foreach (Category parent in ViewData.Model)
{ %>
<h3><%=parent.Name%></h3>
<ul>
<%foreach (Category child in paren...
Hello,
I was wondering if it is possible to create a custom strongly typed HTML Helper in ASP.NET MVC 2? Creating a regular (read not-strongly-typed) helper is straightforward but i am having difficulty creating strongly typed versions. For example, I would like to create a DatePickerFor html helper...
Any guidance or snippets would be ...
I prepared an email that would look interesting, and tried to send it by using Safari. The setup did not come out in the emails the way it looks at the web page. In some web clients only the blue background came out, in others there was no background and the three columns were set one after the other, with the center one last. In other w...
I have enumerations that I need to display in a dropdownlist, and have them pre-populated in my admin pages.
Are there any built in html helpers for this already?
(asp.net mvc)
...