asp.net-mvc-2

DropDownListFor does not set selected value

拜拜、爱过 提交于 2019-12-02 06:14:11
问题 I have a view that is displaying a Drop down list using the HTML helper DropDownListFor <%: Html.DropDownListFor(Function(model) model.Manufacturer, New SelectList(Model.ManufacturerList, Model.Manufacturer))%> My controller is passing the View a ViewModel containing the Manufacturer and the ManufacturerList Function Search(ByVal itemSrch As ItemSearchViewModel) As ActionResult 'some code mapping and model code' Return View(itemSrch) End Function My ViewModel is nothing crazy just fills the

Session lost when using hostname instead of IP address (IE)

梦想的初衷 提交于 2019-12-02 06:10:23
问题 I'm learning asp.net mvc 2, it's very excting with me. I has built a small MVC2 application, it is working fine in built it ASP.net Development Server. However, there're something wrong when have it deployed in IIS 7.5, Window Server 2008 R2 Enterprise. Session is awlays null when I access the application by IE and use hostname to specify the url. Using IE (IE 7 or IE8) to access my application with link http://localhost/ or ipaddress => every working fine But when I use IE (IE 7 or IE8) to

dynamic update target id in Ajax.ActionLink

核能气质少年 提交于 2019-12-02 05:34:35
问题 i have this code in a grid and I want to have UpdateTargetId of the action link, div id to be changed for each row <%: Ajax.ActionLink("Select", "GetCodes", "BvIndex", new { id = o.Id }, new AjaxOptions { UpdateTargetId ="Result"})%> <div id ="Result"></div> I tried this but i didn't get it <%: Ajax.ActionLink("Select", "GetCodes", "BvIndex", new { id = o.Id }, new AjaxOptions { UpdateTargetId ="Result"+o.Id})%> <div id ="Result"+"<%=o.Id%>"></div> I want to have UpdateTarget id to be changed

ASP.NET MVC2 and DateTime Format

陌路散爱 提交于 2019-12-02 04:37:12
问题 I am using ASP.NET MVC2 with MvcContrib.FluentHtml to do form binding. I want to bind a DateTime format to a textbox with specific datetime format. <%=this.TextBox(c => c.date_a).Class("readonly text-box") %> // PS. c.date_a is a DateTime gives me <input type="text" value="5/9/2009 12:00:00 AM" name="date_a" id="datea" class="readonly text-box"> However, I'd like to override the default datetime format. e.g. value="2009-5-9" value="9-5-09" value="09May9" I know I can override the value by

MVC2 RTM - model binding complex objects using Entity Framework

百般思念 提交于 2019-12-02 04:16:07
I am new to MVC, and am really struggling with what I seems like it should be a very common scenario. I'm using MVC2 RTM, and the Entity Framework for my model objects. What I have working: An edit view for a parent object that contains a collection of child objects. The form displays all the editable fields for the parent, and iterates through and displays all editable fields for all the associated child objects (in the same view). I am able to successfully handle the edit action in my controller, but run into issues when I try to bind values in the form collection to the EF model objects.

bind report to reportviewer in web mvc2

删除回忆录丶 提交于 2019-12-02 04:12:33
问题 I have asp.net MVC2 application. I am using VS2008 and want to hook up generated report from my controller to reportviewer. any ideas? so far i have this code "Controller" //should pass data to report public ActionResult GenerateReport() { LocalReport report = new LocalReport(); report.ReportPath = Server.MapPath("~/Reports/KingsCourt.rdlc"); List<InvoiceRow> rows = new List<InvoiceRow>(); rows.Add(new InvoiceRow { name = "Testing item", value = (decimal)25.85 }); rows.Add(new InvoiceRow {

C# MVC2 Jqgrid - what is the correct way to do server side paging?

妖精的绣舞 提交于 2019-12-02 04:12:01
I have a jqgrid where the database table has a few thousand rows, but the jqrid shows only 15 at a time. It should be displaying very quickly (it doesnt take long to query 15 rows). But instead it takes 10 - 20 seconds, which indicates to that it is retrieving the entire table each time. The grid is defined like this: $("#Products").jqGrid({ url: url, mtype: "get", datatype: "json", jsonReader: { root: "Rows", page: "Page", total: "Total", records: "Records", repeatitems: false, userdata: "UserData",id: "Id"}, colNames: ["Product Id","Product Code", ... etc ], colModel: [{ name: "Id", ... etc}

RedirectToAction is not redirecting

僤鯓⒐⒋嵵緔 提交于 2019-12-02 02:56:45
Shouldn't this work? If I had a break point on the last } it stops there but it never gets to the Contact Action, and the page after being posted it's just a blank page with no source code what am I missing ? Thank you. Your Contact(ContactModel model) should not be "void", instead it should be public ActionResult Contact(ContactModel model) { //.... some code return RedirectToAction("Contact"); } 来源: https://stackoverflow.com/questions/4137775/redirecttoaction-is-not-redirecting

Session lost when using hostname instead of IP address (IE)

前提是你 提交于 2019-12-02 02:26:12
I'm learning asp.net mvc 2, it's very excting with me. I has built a small MVC2 application, it is working fine in built it ASP.net Development Server. However, there're something wrong when have it deployed in IIS 7.5, Window Server 2008 R2 Enterprise. Session is awlays null when I access the application by IE and use hostname to specify the url. Using IE (IE 7 or IE8) to access my application with link http://localhost/ or ipaddress => every working fine But when I use IE (IE 7 or IE8) to access my application with link http:/hostname/ => session always null I'm supprised while FireFox

Ways to define an ASP.NET MVC Route

旧巷老猫 提交于 2019-12-02 02:18:55
问题 I was wondering if you could show me all the various ways to declare routes in ASP.NET MVC (1 and 2). Please explain each method of defining a route, how it is used, and what case it covers. Here is an example of what I am hoping to collect here: routes.MapRoute("Directors", "Directors/{filter}/{skip}", new { controller = "Directors", action = "Index", skip = 0, filter = "" }, new { skip = @"\d+", filter = @"^[a-zA-Z]+.+" }); Directors = the name of the route. Directors/{filter}/{skip} = the