When a content placeholder contains any code blocks it reports that the control collection is empty.
For instance:
MasterPage.aspx
<asp:ContentPlaceHolder ID="Content1" runat="server" />
<asp:ContentPlaceHolder ID="Content2" runat="server" />
<div>Content1: <%= Content1.Controls.Count %></div>
<div>Content2: <%= Content2.Controls.Cou...
I have a DLL that is going to return an object(bitmap) and I have to pass it to the browser.
All in memory, no disk access.
I know how to do it with asp.net webform but I have no clue with MVC.
with webform,
since I have control over the dll, I inherit the class with the webcontrol.image.
in the aspx page I create a simple img link ...
asp mvc DropDownList how to pass a selected item in visual basic .net
i put this in the view:
<%=Html.DropDownList("Estados", ViewData("EstadosList"))%>
and the compiler says
that i have to convert to SelectList becouse ViewData Returns an Object
any idea to do this?
thxs..
Fernando Soruco
...
hi all
i am making an application using asp.net mvc+subsonic on northwind data base
i have created view (edit ,delete,create)
every time i try to edit any record from employee table
it gives me an error it said "(item that i had edited)+syntax near employees"
i debug my code and i c that it doesnt return any result so it always go to ...
I use strongly typed views where all ViewModels inherit a class BaseViewModel.
In an ActionFilter that decorates all Controllers I want to use the Model.
Right now I can only access it like this:
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
ViewModelBase model = (ViewModelBase)filterCo...
I dont know if it is a SqlException or not but I will show you the source code:
//the update method
public int Update(T item) { int result = 0; var query = BuildUpdateQuery(item); if (query != null) result = query.Execute(); return result; }
/////////////////////////////////////////////////////////////
public ActionResult Edit(Empl...
Question
How do you handle read-only fields when creating fakes?
Background
I'm in the beginner stages of using ASP.Net MVC and am using Steven Sanderson's Sports Store and Scott Gu's Nerd Dinner as examples. One small problem that I've just hit is how to work with read-only properties when doing fakes. I'm using LINQToSQL.
My interf...
I'm migrating a webforms application written w/ MVP to leverage the MVC framework and wanted to know how I should be testing a simple controller action that returns a partialview. When using MVP i would assert true for each property on the view = the expected value.
Controller action under test
<OutputCache(Location:=OutputCacheLocati...
Hello,
let's say I have a view where I currently only use Model information from my "User" class.
Should I still create an extra viewmodel wrapper or directly return the user class instance to the view?
Directly returned object:
return View(user);
Wrapped in ViewModel object:
return View(new UserViewModel(user));
I'm look...
Hi,
I have a grid that contains Contacts. It automatically shows contacts when people go to the /contacts/ URL. In a separate box, people can filter those by different criteria. I want to refresh only the grid, not the entire page, whenever different criteria are applied.
In order to achieve this, would I put the Contacts Grid by itsel...
I have a lot of Ajax indicators in a Page. Now I use
$(document).ajaxStart(function() {
$('#ajaxBusyIndicator_<%=partido.PartidoId.ToString()%>').css({ display: "inline" });
}).ajaxStop(function() {
$('#ajaxBusyIndicator_<%=partido.PartidoId.ToString()%>').hide();
});
The problem with this is that I ge...
From an ASP.NET MVC perspective, what do you use jQuery for?
Apart from UI "flair" - things like fading colours and pretty animations.
Things I can immediately think of include pop-up calendars and modal popup dialogs, but there must be more...
Edit
I am interested in jQuery uses for things that ASP.NET MVC does not do out of the box...
I have code like this:
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.Title) %>
</td>
<td>
<%= Html.Encode(item.Capacity) %>
</td>
<td>
<%= Html.Encode(item.Count) %>
</td>
</tr>
<% } %>
My problem: Depending on user s...
I have a data class that contains a number of fields:
public class Person
{
public int id { get; set }
public string Name { get; set; }
public double Rate { get; set; }
public int Type { get; set; }
}
If I understand Scott Hanselman's take on binding arrays of objects, I should be able to create a form view that render...
Hi,
I'm currently creating an application using ASP.NET MVC. I got some user input inside a textarea and I want to show this text with <br />s instead of newlines. In PHP there's a function called nl2br, that does exactly this. I searched the web for equivalents in ASP.NET/C#, but didn't find a solution that works for me.
The fist one ...
I have an ASP.NET MVC form that returns a report as a File(...) result. This means that the browser stays on the current page after the file download is triggered. Using jQuery, I would like to disable the submit button and then re-enable it after the file returns.
My code already disables the button just fine, however, I'm unable to f...
It seems to me that ASP.NET MVC Html Helpers only output XHTML-like tags (closed empty elements), which is not valid HTML.
Is there support for HTML output in ASP.NET MVC?
...
I have a simple partial view. The main part of which is listed below. How can I have the ActionLinks resolve properly when this partial view is rendered on a page that is managed by a different controller. In other words - this partial view shows Project Areas for a given Project. What if this PV shows up on a page being managed by the P...
Is it possible to create a "generic" pager (ASCX UserControl) which can be used with different grids on different pages to control paging? So that I only need to render it using RenderPartial.
I'm currently working on a "Contacts" grid, which needs paging functionality, but I will have to reuse paging later, so I wondered if I can make ...
Hi, I'm using VS2008 and .net 3.5. I have created a class library(Myproject.Controllers) in my solution. Under this class, I have added a Controllers folder. And in the folder I have added a MyController which is declared as
public class MyController : Controller
My views are still in the default Views folder. Now, when I run this...