Given a spark view named SomeContainer.spark that uses a partial view this way:
<SomeContent param1 = "Model.SomeValue"/>
and given a partial view named SomeContent.spark that uses the parameter this way:
<div>${param1}</div>
How can I modify SomeContent.spark to declare param1 upfront. I want to do that for two reasons:
Readabil...
Hi,
I've got the following route:
routes.MapRoute(
"Search",
"Search.aspx/l-{lID}/t-{tID}/p-{pID}/s-{sID}",
new {
controller = "Search",
action = "Search",
lID = "",
tID = "",
pID = "",
sID = "" },
new { lID = @"\d{0,}",
tID = @"\d{0,}",
pID = @"\d{0,}",
sID = @"\d{0,}" }
);
Which works fin...
I have a User table and a ClubMember table in my database. There is a one-to-one mapping between users and club members, so every time I insert a ClubMember, I need to insert a User first. This is implemented with a foreign key on ClubMember (UserId REFERENCES User (Id)).
Over in my ASP.NET MVC app, I'm using LinqToSql and the Repositor...
Hi
My jQuery code hides a ddl under certain circumstances. When this is the case, after submitting the form, using the UpdateModel doesn't seem to work consistently. My code in the controller:
// POST: /IllnessDetail/Edit
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(IllnessDetail ill)
{
I...
Hi All, i just started building a small test app to help me learn MVC. i have a view that displays user comments. Under each comment i would like to have a reply action link. Clicking on the link should return a small form for adding a comment directly above the reply link.
What is the general approach for this? I'm imaging the form wou...
I have an ASP.NET MVC web app which has a really basic subscription system on it.
My question relates to where the best place is to implement the subscription end date. At the moment, the following code resides in the Site.master:
if (Profile.expires < DateTime.Today)
{
FormsAuthentication.SignOut();
FormsAuthen...
I am trying to learn MVC, and i'm creating threaded comments functionality for a simple webapp.
I have a view which lists the comments, and has a reply button that uses jQuery to load a partial view which is basically a comment form. I need to pass the parent commentId to the partial view and then populate the parentCommentId hiddenfiel...
I have downloaded a sample mvc application which has a fair bit of code and quite complex. in order to understand the code i want to step through all of the code line by line as i complete basic functions via the gui. problem is i am not always sure which line the code executes from so i cannot always set a breakpoint.
is there a way to...
When the Service layer is only executing a task (checking if Id exists, sending an email, etc.), what is the best way for it to let the controller know if there were any errors?
Two solutions I can think of:
Always passing in an extra "broken rules" parameter by reference to the methods in the Service layer which it would update if th...
I'm trying to pass the header object here:
<%=FileUtil.AddStylesheetToHeader(Header, "UsedItems.css") %>
In my Master page I have a <head runat="server">. And my aspx page definitely has a reference to my MasterPageFile in the page directive at the top of my MVC based .aspx.
I also have an import statement the namespace that the Fil...
I'm a bit grey on what asp.net controls you still CAN use with MCV. What about the literal control? Yes it's all helper methods that spit out HTML but what if you need to add like a literal control or some other control to the Master page Header's collection?
...
i start to study mvc, try to add dropdownlist, make construction
<%= Html.DropDownList("ddl") %>
but it show error
There is no ViewData item of type 'IEnumerable' that has the key 'ddl'
why? i use simple code, only pass name parameter, so why the error?
...
i have model, in model such method
public Pages GetPage(int? id)
{
return _dataContext.Pages.First(p => p.id == id);
}
if i pass whong parameter (like 123333-no record it database), it throw exception
Sequence contains no elements
can you suggest correct code version, or simply use try\catch?
...
I have the following code in my view:
<%= Html.ListBoxFor(c => c.Project.Categories,
new MultiSelectList(Model.Categories, "Id", "Name", new List<int> { 1, 2 }))%>
<%= Html.ListBox("MultiSelectList",
new MultiSelectList(Model.Categories, "Id", "Name", new List<int> { 1, 2 }))%>
The only difference is that the first h...
I read the Pro .Net Asp.net MCV book over the weekend and it provides some good examples on setting it up and using it. However my question is what is the structure of an MVC project should be. I ran into problems once I started trying to transfer control from one controller to another. It seems that you can have multiple views within...
I have a page load event on view side where i want to display a string using window.open().
Since window.open() cannot be written directly under page_load I am building a string which contains window.open() syntax and which is passed further to RegisterStartupScript(). Actual URL passed to window.open will call a post method which will p...
is it a good idea to keep the user's role together with his name, like when you do setAuthCookie you do:
formsAuthSrv.SetAuthCookie(strUser+strRole);
and you can do your own roles provider like this:
public class MyRoleProvider : RoleProvider
{
public override string[] GetRolesForUser(string username)
{
...
Hi,
I would like to use workflow as a back-end logic for my asp MVC application, is this a good combination?
How can this be done for complex application logic?
Thanks.
...
When you create a ASP.NET MVC 2 web application in Visual Studio, it gives you a default MVC site. It shows 2 menus [Home] and [About]. When you hover these menus it gives you this URL:
[Home] localhost:1234/
[About] localhost:1234/Home/About
Why is About under Home?
I want menu links like
[Home] localhost:1234/
[About] localhost...
I have a view & controller that allow the user to upload a file to the server. This is done in the view using an input type='file' and in the controller by getting the value of Request.Files (HttpRequestBase, returning a HttpFileCollectionWrapper).
I am having difficulty mocking this using Rhino Mocks.
HttpContextBase mockHttpContext =...