Hi. I'm want to do a class with file extensions, I thought the extensions should be strings.
My problem is I'm not sure how to do this class? I want it to be kinda static so I don't have to declare it like new. I would appreciate any help I can get on this, it's often I find myself in situations where I would need a class like this.
EDI...
i have a ApplicationController class with an action called Admin
so my url is www.mysite.com/Application/Admin
is there anyway i can have the routing be www.mysite.com/Admin and go to this method.
i know i can do this by creating an AdminController but for this one function i thought it was easier to just put in another controller
...
I have some code that generates a model and a controller class:
public ActionResult Generate()
{
ModelGenerator model = new ModelGenerator("c:/Upload/SampleModel.cs", "CodeDOMSample");
model.addProperties();
model.addConstructor();
model.GenerateCSharpCode(model._outputFileName);
Type t = Generator.CompileDOM(model....
Hi, I'm trying to mimic the webforms multiview functionality and the only way i can think of is to put a PartialView into a ViewData object? Something like the following:
View code:
<%= ViewData["PartialViewPlaceholder"] %>
Controller code:
if(//condition){
ViewData["PartialViewPlaceholder"] = partialView1;
} else {
View...
Will's Error handling post is awesome! I'm not yet using ELMAH, but I'd like to start adding some of my own data to the Exception on a per Controller basis. Right now, I have a base controller overriding OnException(ExceptionContext) as per Will from which all project Controllers inherit.
I think I understand I'll need to customize ano...
Hi
I have page with a simple table and advanced search form. I pass List<Customers> to the model:
View(List<Customers>);
So what is best way to pass and return data to the search form? I want to use validation or something but I think passing data through ViewData is not good idea. Any suggestions?
...
Recently I made a little site and want to rewrite it using ASP.NET MVC. At the same time I am going make some improvements: insert site map path, hierarchical menu on the side (current article should be selected) etc.
Should I use individual ContentPlaceHolder for each such page part or just use one and create such large view model for ...
I have a link in my action like this
<%: Html.ActionLink("View Data","Index","MyItem", new {itemId=Model.itemId}, null)%>
now in my newItem controller in its index action how do I retrieve this itemId, so far I have tried
this
public ActionResult Index()
{
RouteData rd = this.RouteData;
var list = from...
I am writing a VirtualPathProvider to dynamically load my MVC views, which are located in a different directory. I successfully intercept the call before MVC (in FileExists), but in my VirtualPathProvider, I get the raw, pre-routed url like:
~/Apps/Administration/Account/LogOn
Personally, I know that MVC will look for
~/Apps/Adminis...
Hello friends,
I need to Loop my FormCollection to get Id values from collection..
I have something like
collection[0]
collection[1]
collection[2]
collection[3]
collection[4]
collection[5]
collectoin[6]
I have 7 or more keys I need to get second Index that means 1 3 5 7 9 11. something likethat..
I need to loop to get those value...
var debtProtectionId = 0
// get the selected id of debt protection dropdown
if (mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue() != '') {
debtProtectionId = mainPanel.generalPanel.calculationsFieldSet.debtProtection.getValue();
}
// get the store record with this id
var storeRecord = planC...
I want to render specific HTML in a partial view based on whether javascript is enabled or not. My idea was to some how detect whether javascript was enabled and store it in a session variable which I can then test for in my view e.g.
<div class="product">
<%
// if Javascript is enabled, load the images asynchrously, otherwise load ...
I'm starting with a legacy webfoms program and adding mvc. I have mvc setup, but I can't get the mvc templates to show. I dont have a csproj file; I only have a solution file that points to a folder containing the files of the project;note, it is not pointing to a .proj file. It seems that you can only specify one guid that determines t...
What's your experience with http://silverlightuploader.codeplex.com? Is it ready for production use?
...
Here is my database Structure
Languages
LangID PK
LangName nvarchar(100)
Category
CatID Pk
IsActive Bit
CategoryText
CatID FK
CatName nvarchar(200)
LangID Int
Language
LangID | LangName
1 | English
2 | French
Category
CatID | IsActive
1 | True
2 | True
3 | True
CategoryText
CatID | CatName | ...
This is a topic which has been rehashed over and over, I'm still not comfortable on how all the pieces fit together: ViewPage/ViewMasterPage, ViewPage.Model, so forth.
I've entered an undertaking where model data must be passed to both the MasterPage and the ViewPage that derives from it. The data that is passed down need not be shared ...
How Many Times Does an ASP .NET Application Start?
I want to run something once per AppDomain (specifically RegisterRoutes). If I put the code I want to execute in the global.asax in Application_Start, everything's good (or so it seems) and the code seems to only execute once.
But If I have a custom HTTP Module registered in the web.c...
Hi, I'm looking for a good clean solution to detecting whether a user has been logged out of an ASP.NET MVC application from Silverlight when performing a web request.
The problem is that the website has a Silverlight component that the user could potentially spend a large part of his time in, thus letting him get logged out of the webs...
I found the following page on i18n and ASP.NET: http://wiki.asp.net/page.aspx/55/internationalization/
The videos were very helpful although they apply to ASP.NET WebForms more than ASP.NET MVC, e.g., the videos show you how to internationalize controls rather than text -- which leads me to another realization: there isn't (or I couldn'...
I am making an ajax call using the following code.
$.ajax(
{
url: '/BuildingCompany/EditAjax/' + id,
cache: false,
type: 'POST',
data: ({ imageValue: $(this).attr("src") }),
contentType: 'application/json; charset=utf-8',
dataType: 'json'
}
In the EditAjax action...