I have a partial view that I use for editing and creating my models. When a user is editing the model, I would like a particular drop-down to be rendered as text as I don't want them to change it. A read-only drop-down would suffice, but I'd prefer text.
I'm thinking I can accomplish this via an extension method, but I'm not quite sur...
I have the following code in my controller (for Edit and Create):
model.Templates = new SelectList(PageManagementService.PageTemplateFetchList(), "PageId", "Title", 213);
the "213" is an Id for one of the pages - just using it for testing.
And this is in my view (for Edit and Create):
<%= this.Html.DropDownListFor(model => model.Pag...
As the question title explains, what is the best way to specify a format which my Views use when displaying values of a DateTime property via the Html.TextboxFor method.
The default display includes the Date and Time where I really only want the Date displayed.
Thanks
...
I tried the MVCScriptManager from CodePlex and it seems to work well until you try to use it in conjunction with a ViewUserControl.
When it is used in this type of scenario it gives the following error.
A ScriptManager with RenderMode set to
Master is not present. Such
ScriptManager must precede one with
RenderMode set to Slav...
I'm creating a messaging web app in ASP.NET and are having some problems when displaying an error message to the user if they go to send a message and there is something wrong.
A user can look through profiles of people and then click, 'send a message'. The following action is called (url is /message/create?to=username) and shows them ...
Cannot call action method 'System.Web.Mvc.PartialViewResult FooT' on controller 'Controller' because the action method is a generic method
<% Html.RenderAction("Foo", model = Model}); %>
Is there a workaround for this limitation on ASP MVC 2? I would really prefer to use a generic. The workaround that I have come up with is to change...
I have a WCF service that will be using basic authentication and would like to be able identify "who" is trying to use the service. I know that the HttpContext.Current is NULL and in the WCF service, but do not know what the alternative is to get the username.
For the website, I can use:
userName = HttpContext.Current.Request.Server...
HI all,
I am looking for a way to generate and validate mvc 2 forms using untyped entities. Basically similar how the propertygrid in winforms behaves.
In the utmost basic sample for instance have an dictionary and generate a form from that depending on the datatype in the Dictionary ofcourse it should be able to fill the same dictiona...
Hi,
I am using asp.net MVC 2 to develop a site. IUser is used to be the interface between model and view for better separation of concern. However, things turn to a little messy here. In the controller that handles user sign on: I have the following:
IUserBll userBll = new UserBll();
IUser newUser = new User();
...
Hello All:
I have one MVC view page in which I show different links and I am using ThickBox to show a different page when ever one of these links is clicked. In these pages, I am using jQuery functions to do some changes, but I am not able to resolve the jquery file path on the view pages. I need to give absolute path something like "ht...
With this script I get data from JsonResult (GetDevicesTable) and put them to table ( id="OrderDevices")
<script type="text/javascript">
$(document).ready(function() {
$("#getDevices a").click(function() {
var Id = $(this).attr("rel");
var rowToMove = $(this).closest("tr");
$.post("/ImportXML/GetDevicesTab...
How can we get an autogenerated Id from the Table While Inserting?
I have three tables
Project
ProjectXMilestone
Milestone
and on Insert of Milestone I also want to insert a row in 2nd Table so I need MilestoneId?so how can I get that?
I am using Linq.
...
I'm experiencing the a challenge in populating the child records.
My previous code was like -
<%= Html.TextBox("DyeOrder.Summary[" + i + "].Ratio", Model.DyeOrder.Summary[i].Ratio.ToString("#0.00"), ratioProperties) %>
This code does not render the updated values after post back. To resolve this issue my work around was like -
<%=...
I'm currently trying to grasp MSpec, mainly to learn new ways of (T/B)DD to be able to make an educated decision on which technology to use. Previously, I've mostly (read: only) used the built-in MSTest framework with Moq, so BDD is quite new for me.
I'm writing an ASP.NET MVC app, and I want to implement PRG. Last time I did this, I us...
Hi everyone,
i've got a situtation where we have a web site (mvc project), and a wcf service, when service gets message i need to show a notification to user who's on the web site with this message contents.
would be glad if you can show me the place where to start!
Thank You !
...
Hi.
I need to convert below mentioned file formats to pdf using C#/VB.Net. User will upload the file using FileUpload control and system will returns the pdf file after converting the document.
doc/docx to pdf
xls/xlsx to pdf
ppt/pps to pdf
Does ITextSharp provide such facility ? Please Only mentioned open source or free libraries.
T...
Hi, i'm trying to write a text file on remote server,
i'm using the following code:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(UserModels model)
{
if (!ModelState.IsValid)
{
return View("Index");
}
try
{
using (StreamWriter w = new StreamWriter(Server...
i am using partial view for my project but my problem is that my links are on right side of masterpage and when i clicked on particular link the view should displayed on left side on contentplace holder of master page. but right now its showing exactly below so my whole disgne is distrubed.
how to position partial view in asp.net mvc th...
Hi,
This is my first post here, so hello :) Okay, let's get to the point...
I am writing my first app in ASP.NET MVC Framework and i have a problem with checking privileges to use instances of model classes (read, edit). Sample code looks like this:
// Controller action
[CustomAuthorize(Roles="Editor, Admin")]
public ActionResult Stat...
How can I intercept submitted form input and modify it before it is bound to my model? For example, if I wanted to trim the whitespace from all text.
I have tried creating a custom model binder like so:
public class CustomBinder : DefaultModelBinder {
protected override void SetProperty(ControllerContext controllerContext, ModelBind...