Hi everyone!
I have a page "Results" with a form and when "submit" is clicked, the form is submmited to another Action. So far, so good...
But, this works fine just if user is logged in. If not, he will be redirected to "Login" page and my FormCollection loses its data.
Is there a way to persist this data without using TempData??
Tha...
I am interested to know what you guys feel should be deemed "correct behaviour" in terms of the UpdateModel method in ASP.NET MVC.
The reason I ask here is perhaps if this functionality is "by design" somebody could clarify as to why it is the way it is, and perhaps a way to call it differently to achieve desired functionality, which I ...
I have a controller with the codes like this:
[AcceptVerbs("POST")]
public ActionResult Create(FormCollection collection)
{
//why is that the collection is null?
}
I am calling this action using the ajax.actionlink.
my problem is the collection is null, unlike if i use the submit(input) button
the formcollection has values.
...
Hi Experts,
In asp.net MVC application we have mechanism where, when we submit
a form and if there is any problem with the values (validation fails),
the form is displayed back maintaining old values. How does it happen ?
Where are these values kept ? or they collected from FormCollection.
Help will be apprititated.
Regards
Parminder...
I am creating an application that will display a list of objects in a datagrid (list of any type of object), and allow the user to update any item. The code will know nothing about the object being displayed until runtime. Can you improve my code for the update? I am using Formcollection to get items from the form and creating an instanc...
I'm passing in some model information to an ActionLink, but I'd also like to provide the action with the values of some inputs on the page. For example, if I had something like this:
<input Name="MyInput" />
<%: Html.ActionLink("MyAction", "MyController", Model.Value);
I'd like the action to be aware of both Model.Value (which is pas...
Hello everybody!
I am currently developing an application with the new ASP.NET MVC2 framework. Originally I started writing this application in the ASP.NET MVC1 and I'm basically just updating it to MVC2.
My problem here is, that I don't really get the concept of the FormCollection object vs. the old Typed object.
This is my current ...
i am posting a simple action.
public void Login(FormCollection formCollection)
{
...
}
Even with few querystring values, the formcollection.Count is 0. Is it by behaviour?
...
Hi guys. I am fairly new to MVC. I am trying to set up a search page that searches a database and returns results. The search box is within a Html.BeginForm in my View, and looks like this:
<% using (Html.BeginForm())
{ %>
<%= Html.TextBox("searchBox", null, new { @id = "searchBox" })%>
<div id="searchButtonsDiv">
...
Hi all,
My scenario is this: I have two listbox's, one that contains all my database items, and an empty one. The user adds the items needed from the full listbox to the empty listbox.
I'm using a form to submit all the items the user has added.
The problem is, only the selected items from the listbox are submitted. So if the user des...
I have a form with two submit buttons in my asp.net mvc (C#) application. When i click any submit button in Google Chrome, by default the value of submit button is the first submit button's value.
Here is the html:
<input type="submit" value="Send" name="SendEmail" />
<input type="submit" value="Save As Draft" name="SendEmail" />
<i...
Given multiple HTML checkboxes:
<input type="checkbox" name="catIDs" value="1" />
<input type="checkbox" name="catIDs" value="2" />
...
<input type="checkbox" name="catIDs" value="100" />
How do I retrive an array of integers from a FormCollection in an action:
public ActionResult Edit(FormCollection form)
{
int [] catIDs = (IEnu...
In database I have Contacts table:
ContactID (int)
FirstName (varchar)
LastName (varchar)
...
XmlFields (xml) // This field is xml type
To create a new contact, I created two classes - one for regular fields and other to display fields from XmlFields field.
In Controller, I have following:
public ActionResult Create(Contact contact,...
My controller calls a repository class method on insert,
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create([Bind(Exclude = "Id")]FormCollection collection)
{
try
{
MaterialsObj materialsObj = new MaterialsObj();
materialsObj.Mat_Name = collection["Mat_Name"]...
anybody knows how to transform the FormCollection into a IDictionary or how to get a IDictionary in the post action ?
...
i have a javascript object, obj, that gets passed to an mvc action via a $.post() like so:
var obj = {
Items: [{ Text: "", Value: { Property1: "", Property2: "" },
{ Text: "", Value: { Property1: "", Property2: "" }]
};
$.post('MyAction', obj, function() {});
the action signature looks like this:
public ActionResult M...
Hi,
I am using asp.net mvc. I have used two list box in one of my views.
I transfer desired items from left-hand-side list box to right-side list box.
On a button click, i want to get the list box contents from right side list box.
I don;t get in form collection. Can anyone please suggest how can I get it?
thanks,
kapil
...
in my view I have several [n].propertyName array fields I want to turn the formCollection fields into objects myobject[n].propertyName when it goes to the controller.
so for example, the context:
View:
foreach (var item in Model.SSSubjobs.AsEnumerable())
<%: Html.Hidden("["+c+"].sssj_id", item.sssj_id ) %>
<%: Html.Hidden("["+c+"]...
Hi there
If I have [0].propertyname, [1].propertyname, etc in my FormCollection how would I go about updating the model?
if I do this:
public ActionResult Edit(int id, FormCollection collection){
IList<SoilSamplingSubJob> sssj = orderRepository.FindSubOrders_collection(id);
UpdateModel(sssj, collection.ToValueProvid...
I'm passing a List to an MVC view and generating checkboxes for each object in the list (The checkboxes are named t.Name).
I'd like to be able to tell which checkboxes were checked once the form is posted. However, I'd like to avoid using the FormCollection object. Is there any way to do this?
...