Every controller class in my project derive from a base controller class, aptly named BaseController.
All view data is contained in a class named BaseViewData (which in the future could become the base controller for more specific view data classes).
I made a BaseViewData property on the BaseController since every controller requires a...
My model object has an int property named SpecialProjectId. That property corresponds to a select box. I am using a default option in the select box. However when I submit the form with the default value the ModelState.isValid keeps being false because the default select option has value="" and for some reason the default binder is NO...
How are people doing their validations on data?
Basically I have a requirement that to apply for insurance you need to be over 14 years of age.
Now, on the application form you may need to not only enter your age but any nominated drivers date of births as well.
I went through the Nerd Dinner example and it works but I was wondering...
Is there any IOC container that already implements a controller factory compatible with asp.net mvc 2.0 ....if so i'll move my projects to 2.0 to test...
Anyone know a good reference about it?
...
I have this code in my view:
<%=Html.ActionLink("Approve", "NewsApprove", New With {ID}, DBNull.Value)%>
in my controller:
Function NewsApprove(ByVal dID As Integer) As ActionResult
dTempNews.ApproveNews(dID)
Return RedirectToAction("Administrator")
End Function
My problem is that it always return an error that says:
The pa...
Consider the following code:
public ActionResult GenericActionForSomething(string objectType)
{
switch (objectType)
{
case "Business":
// Do Something with object here, like save
_db.Create<Business>();
break;
}
return View();
}
How can I convert ...
Hello
I'm having problems with deciding where to store files uploaded by user in my asp.net mvc application.
I've been using asp classic for about 10 years now, and always stored my files on disc at the site, and storing filename and folders in database.
How would you guys approach this problem?
Having them in database, and might ...
As a learning exercise, I want to migrate an existing flash application to ASP.NET MVC. It has around 20 forms, and although it's mostly linear, there is some degree of alternate flows based on user decisions or data returned.
Could anyone point me in the right direction of how a controller would handle this? I don't want my views to ...
Is it possible to create a Gannt Chart using MS Chart?
The chart will be created based on data returned from a web service.
We are using ASP.Net MVC. From other posts it appears that MS Chart does not support ASP.Net MVC. If this is the case we can place the chart on a web forms page.
...
I have installed VS 2010 and builded a project and added the assembly in GAC 4.0.
But How to refer this assembly in a application.
I have created new application and going to add -> reference I couldn't find the assembly which i was installed. But its their if we seen thro' the physical path of the GAC.
...
The thing is that all my ids are encrypted and I have 2 methods that parses the Id from long to the Encrypted (something like A8sdf=dsfs=) and back so I have to do this conversion in each action method when I send or receive an EncryptedId
Is it possible to modify the value for a specific type or Property Name before it reaches the act...
What Blog engine does MVC CMS and The Beer House use?
...
I have a button that will create a new entry (row in a table) dynamically using jquery. Each entry is a row in a html table.
for each row, each column has an input (textbox, radio button, checkbox) etc.
because you can add as many rows as you like you end up with some array or collection of these rows.
When i post the form, i dont ...
I have an MVC Controller with an action
public ActionResult GeneratePDF(string id)
{
FileContentResult filePath = this.File(pdfBuffer, MediaTypeNames.Application.Pdf);
return filePath;
}
And for some reason it is taking over 20 seconds when it hits the return line.
The pdfBuffer is working okay, and when I run it on my ...
I would like to limit a textbox to 10 characters in MVC.
<label ID="lbl2" runat="server" Width="20px"></label>
<%=Html.TextBox("polNum") %>
<label ID="lbl1" runat="server" Width="10px"></label>
I know you can set the Max Length property in .net. How do I do that in MVC with a textbox generated this way?
...
let say your controller action looks like this:
public ActionResult Update(Car myCar)
{
}
if you have a textbox that has
<input type='text' name='year' value='1990'>
it seems like it will bind to the myCar.year field just fine
but if you have nested objects or complex lists, etc, it seems like you have to qualify the names of con...
Hello,
I am quite new to ASp.net MVC so it might be really trivial for you. Still, I have this question to ask : I want to display an image or not according to a booleean.
With classis asp.net, i was databinding the visible property with my boolean and then Hop, the trick was done. But here it doesn't work this way. I have browsed the ...
I want to disable Browser Caching in a specific View.
I tried Response.Cache.SetCacheability(HttpCacheability.NoCache); in a controller that returns the View, but that does not work.
Any suggestions are greatly appreciated.
Thank you.
...
I have a method in my controller like this
public string UpdateResource()
{
Thread.Sleep(2000);
return string.Format("Current time is {0}", DateTime.Now.ToShortTimeString());
}
I have a html button in my view page and when I click on that I want a loading gif image to appear and then disappear after 2000ms. Below is my html
...
I need to create a helper function for UpdatePanelAnimation extender from AjaxControlToolkit in asp.net mvc. I downloaded the toolkit and loaded the js files into my project.
Can someone please tell me how should I write this helper function and what all parameters are to be passed into it.
I am new to asp.net and mvc
thanks for th...