My mvc page returns json by using the function Json(mycustomclass) to return a JsonResult object.
This works just fine except, I need to wrap the json in a callback so that jQuery can use it.
I want it like this:
jsonp1246168411282({"myjson":"some values"})
but I am getting this:
{"myjson":"some values"}
Is there any way I can 'wrap'...
List<SelectListItem> items = new List<SelectListItem>();
if (a)
{
SelectListItem deliveryItem = new SelectListItem()
{
Selected = a.selected,
Text = "Delivery",
Value = "1"
};
items.Add(deliveryItem);
}
if (b)
{
SelectListItem pickupItem = new SelectListItem()
{
Selected = b.selec...
Hi,
I've been trying to do a messagebox in a controller in asp.net mvc, but every time I type MessageBox or MsgBox it doesn't give me the option to import a namespace...
What can I use that would be similar to a MessageBox?
...
i downloaded asp.net mvc and i am playing around with the main tutorial.
In the upper right, when i click log in or register new user, i am trying to understand where this data is being stored. I dont see any SQL database or any other data store.
i see something that says this below:
// Attempt to register the user
...
Here's my method
[AcceptVerbs(HttpVerbs.Post)]
public void SaveImage(FormCollection formValues)
{
byte[] contents = Convert.FromBase64String(Request.Form["file"]);
System.IO.File.WriteAllBytes(Server.MapPath(Request.Form["name"]), contents);
}
It is getting posted to from this actionscript method:
...
I have following method in wcf webenabled service
Public Person AddPerson(Person p);
As of now in traditional asp.net application i am using scriptmanager and it allows me to created javascript object like following to pass it in ajax call
var person = Person();
person.name = "mamu";
phonenumber = 911;
ajaxService.AddPerson(person, c...
i am new to asp.net mvc so please be explicit as possible.
Here is my goal:
i want to create a simple website where users can:
Register and log in
Enter there contact details(phone, address, etc)
View there contact details
Edit details of #3.
Later in the website, i will create other pages that use this data but for now the only i...
i was looking at an example of how to do an insert in Linq to SQL and here it was it said:
NorthwindDataContext context = new NorthwindDataContext();
context.Products.Add(new Product(..));
context.SubmitChanges();
but when i look at the below, (in my case the Table is UserInfo), the Table doesn't have an "Add" method:
public System.D...
Somehow this update code is not working:
Here is my Controller code:
private UserRepository repo = new UserRepository();
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, UserInfo user_)
{
try
{
repo.UpdateUser(user_);
return RedirectToAction("Index");
}
...
i have generated the views (Create, Edit, Index, Details) for a table using LINQ to SQL.
My question is:
Once the views are created in Visual Studio using "Add, View", they dont change when i update the database (using Server Explorer) and the LINQ to SQL code.
Is there anyway to "Refresh" the view code, or do i just have to delete t...
I am basically taking the default ASP.NET MVC template and extending it:
Looking at the site.master, I see this for menus:
<ul id="menu">
<li><%= Html.ActionLink("Home", "Index", "Home")%></li>
<li><%= Html.ActionLink("About", "About", "Home")%></li>
</ul>
I am then editing it by the following:
<ul id="menu"> ...
I'm really new to asp.net and mvc, so I'm a bit lost.
I'm managed to log in with OpenID in my application using this Tutorial.
But I'm not sure if just setting Session["Admin"] = true is the right path to follow, so far my code is something like this:
switch (openid.Response.Status)
{
case AuthenticationStatus.Authenticated:
if ...
I have the following code in my site.master for a menu:
<ul id="menu">
<li><%= Html.ActionLink("My Contact Info", "DetailsbyUserName/" + Html.Encode(Page.User.Identity.Name), "Users")%></li>
</ul>
When I hover over the URL I see that it points to:
http://site/Users/DetailbyUserName/[name]
which is correct.
The iss...
I need to render a list of Person objects, say, in a comma delimited format using a Partial View in ASP.NET MVC. My problem is that when rendered using the following code:
<% foreach (var person in Model) { %>
<%= Html.ActionLink<PersonController>(c => c.Edit(person.PersonID), Html.Encode(person.Name)) %>,
<% } %>
I get a tr...
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://mysite.com/Content/MyFlashApp/myflash.swf cannot load data from http://www.mysite.com/Home/SaveData.
at Main/encodeAndSave()
...
I thought this would be fairly easy, but I'm totally baffled.
I want one controller's views to be at the root level of the application, rather than in a subdirectory for that controller, but I cannot figure it out.
I'd like to have these two urls:
/Info - This should action "Info" on controller "Home"
/Admin/ - This should be action...
Hi,
I have a page that has fields dynamically loaded via JQuery. It allows a user to add additional fields and data on the fly.
Currently that data is collected via JQuery and sent via an Ajax request to be dealt with.
But is there anyway of doing this in a normal action post? Currently it seems that the dynamically inserted fields are ...
I have an MVC application. Say for example if we have a dropdown Cars makes which when selected posts to itself and gets Car Models. Now on post, the field Car makes loses it value. I am using Form.Get("combo_box_field_name") and if it has a value I am prepopulating the car make dropdown. As lot of controls on my form do this sort of pos...
I have done a lot of research on trying to accomplish this, but I have not really found a clear cut "best way" to accomplish this. I am working on an application that has many distinct groups of users, essentially it allows multiple companies to use the same application - very much like Google apps. Here is an example of what I mean:
...
Need some pointers for this. Found this and this, but I'm still kind a confused.
I just want to mock ActionExecutedContext, pass it, let filter to work a bit and check result.
Any help?
Source of filter you can find here
(it's changed a bit, but that's not a point at the moment).
So - i want unit test, that RememberUrl filter is ...