I have a collection of items in a model that I am looping through to display a very simple editable grid like this
[Code]....
but the values typed in in the textboxes do not appear to be anywhere in the model post data , does anyone have any pointers , this mustbe a common scenario and just cant find solution.
I got 2 listboxes in a window form, one on left and one on right. The 1st listbox have some items while the 2nd listbox is empty. Also there are 2 buttons between the 2 listboxes which used to move item from/to the 1st and 2nd listbox.My problem here is that after I bind the data to the 1st listbox (from a dataTable, using DisplayMember and ValueMember) , and I try to move 1 of the item from this 1st listbox to the 2nd listbox and I want that the selected item is also removed from the 1st listbox by:
But the selected item is not removed from the 1st listbox.Also on deselect button when i move item from 2nd listbox to 1st listbox,it displays error message "Items collection cannot be modified when the DataSource property is set."
I got a list of checkboxes on my form, and a jquery script that catch a button click to get all the selected items (in an array) and post to a controller action.
This is my script: (yes A, looked at your sample but cannot get this to work)
[Code]....
That alert will print out correctly (like 1,3,5).
However when the above post hit my controller action, "selectedInvestments" are null, which I can't figure out why (back to my tekpub jquery videos, can't go on like this)
but what if I wanted to bind to collection items within the ViewModel. I'm not sure if it's possible. Here's what I have:
My ViewModel:
[code]....
I'm getting the following error: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
and print the indexes in an HTML list, here's the results that I get...
Using blockRetrievedList.BinarySearch('Larry'); : 1 Using blockRetrievedList.BinarySearch('Mike'); : -5 Using blockRetrievedList.BinarySearch('Sue'); : -5 Using blockRetrievedList.BinarySearch('Bob'); : -1 Using blockRetrievedList.BinarySearch('John Barrowman'); : -1
So while Larry comes out fine at index one, John Barrowman and Bob should be indexes 2 & 3 respectively. However, they're coming up -1 meaning they're not recognized as being the collection. Further Mike (who was originally in the set, but who has now been replaced by John Barrowman is coming up -5. Isn't that supposed to be -1? And why on Earth is Sue (who is index 0, returning -5 as well?
I'm trying to do this: Editing a variable length list, ASP.NET MVC 2-style
In the post he mentions that it could be done with less code using Html.EditorFor(), but that it would be more difficult because of the indexes. Well, that's exactly what I want to do, and I don't know where to begin.
Update 1: Instead of generating a GUID for each item in the collection, I'd like to generate incremental indexes starting with 0. Right now the field names look like "gifts[GUID].value"; I would like them to be "gifts[0].value","gifts1.value" etc. but I don't understand how the collection keeps track and generates these indices.
I have a list of objects that I want to bind to a gridview. Creating that list and binding it works fine for most of the public properties in that list.
There are some objects contained in each of those objects... for instance there is an Address object.
object.Address.Line1;
object.Address.Line2;
When I bind this to my gridview, I have no issues with stuff like object.DateRegistered, but how can I access things like object.Address.WhatEverProperty? I always get this error:
"A field or property with the name 'xxx.xxxx' was not found on the selected data source."
I have an ASCX control which is a special dropdownlist. I add that control dynamically to the page and fill it with data. This control has a postback that will change the contents of a second dynamically created standard dropdownlist.
When I change the selection on the first dropdown, the indexchanged fires and I get new data and attempt to place it in the second dropdownlist's items collection, by first clearing it then filling it with new data.
This works fine the first time a change the selection, but when I select a second time the following error is thrown:
The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.
I'm not adding or removing new controls in the fired event, only changing data. And again, it works the first time, but doesn't subsequent times.
If I disable stateview on the child control, then the control just doesn't get updated with data at all.
below is the code I have but I want to change the ddl.Deal(dropdownlist) to cbl.Deal(checkboxlist).. How can I loop throught each items if checked. and if all items are checked. to filter my data and show in gridview..
protected void btn_Click(object sender, EventArgs e) { myAPI.myWeb myAPI = new myAPI.myWeb(); myAPI.SearchParameters sSearchParameters = new myAPI.SearchParameters();
I have an ASP.NET app with lots of textboxes all over the page that need updating at various points through program execution.
These textboxes actually belong to a certain class, so for easy updating I thought I could create a Dictionary(Of string, object) and add the control.ID and the control to it and then for updating do something like this:
(in case of updating textbox.text):
[code]....
However the text property of the textbox does not actually get updated. I'm mainly trying to avoid having to manually do textbox.text = somestring for each one of my textboxes every time I have to update them.
I am posting data to an external website server side. This works when the data parameter is less than about 640 characters. The data gets truncated beyond around 640 characters. The code I'm using is below:
Function PostData(TransId As String, QuoteNumber As String, data As String) As String Dim url As String = "http://localhost:49608/test2.aspx" Dim encoding As New ASCIIEncoding() Dim request As WebRequest = WebRequest.Create(url) request.Method = "POST" Dim postData As String = "WAA_PACKAGE=Vendor&WAA_FORM=blahblaj&WAA_HTML3CLASS=nHTML&VendorID=ENG3135&"
I have a simple Usercontrol that has an image and textbox. This has just been really difficult to use, and I am wondering what I am doing wrong.
[Code]....
The first problem is the in the Page_Load procedure. It seems that if I create this control dynamically, the Page_Load is called before the image or textbox are created making it impossible to intiantiate the objects. Since this was so difficult, I just created 5 of these usercontrol and put them on the page.
[Code]....
I can now set the image src from my code, but when I click submit, there is no information about the textbox contents (as well as the image contents). The information shows in the browser, but it is not returned to the server code behind section of my code.
I have a problem posting xml Data using HttpWebRequest..
The server returns Internal error..
I want to simulate a simple Form with Method=Post. The form have three fields. Two for credentials and the third one for Posting XML. Here is the sample HTML which i want to simulate using HttpWebRequest..
I have a some problem while Posting xml data Using HttpWebRequest. Actually I want to Post 3 Form variables
2 of them are for credential and the third one is for XML data to an api, The api will authenticate and will process the xml data, and will return success if no error found.
Here is what there documentation says.
The data will be passed to the gateway via an HTTPS FORM post and a string value of "success" will be returned upon successful receipt of the data. Three total FORM variables will be posted, two of which will contain credentials, and the third will contain the HR-XML data. A string value of "error" will be returned if the posting fails for any reason.
Form Fields integration_field1 = 1234, integration_field2=2345pwd, hrxml=form field containing the HR-XML order (string)
Well, as you see clicking the button will redirect user to "http://www.somesite.com/somewhere" and also will post three specified fields as data to that page; which can be retrieved using Request.Form["field#"] at destination.
I want to do all these works using C# or VB.NET code, because I don't want my hidden fields to be accessible to users (who may use firebug or something similar).
Im having trouble with posting data from a view that also contains a partialview. Im using a viewmodel that has 2 objects in it. The data that comes from the view is correct and fine, but the data that im trying to get from the partialview is null, or rather the object is null. The partialview doesnt contain that much, the user can check/uncheck some checkboxes and thats it. Heres how the partialview looks like
I am using asp.net mvc 1.0. In this I have to create an UI for modifying the profile of the user. Now this modfiy profile will contain jquery tabs. and each jqeury tab will show some results such as user's personel information, professional info, etc on seperate tabs. I also want to give user ability to modify the fields and save this modified data. I am just not getting any idea how to do that. I have searched on internet for various jquery examples. most of them are just showing data to user by creating some partial views. Also i am not getting exactly how this functionality can be achieved through ajax on click of button.
Since we can't post data to cross domains, I want to post the data to my aspx page and a code-behind code will take the data and submit to cross domain (which is not being operated by me, so I don't have permission to modify source code for jsonp) and also the website to which I pass my post data is also returning a cookie which includes shopping cart info and I need to store it on my local browser cache as well.
What I know is I need to use WebResponse and WebRequest classes for that manner.
I am running the code below to authorize payments but I wanted to know how secure is it to submit sensitive data like that, do I have to worry about any issues going on or no?
i have a widget(say some widget to get two cities) on my home page. also a submit button. when the user clicks the submit button, the value of cities given in the widget is passed to the next page and displayed in two text boxes respectively. sample code given below.
how do i acheive this? also, where should i modify the code. in the target page(search.aspx) rite? also which section of that page? some key words pls??
I have a Person class with an Address property. The Address contains a Country property of type Country which in turn has a CountryCode property of type string, as follows:
Person.Address.Country.CountryCode
I have a select element on the page with a name of "Country.CountryCode". With MVC 1 this was bound perfectly to the CountryCode property of Country. In MVC 2 however, I get the following error when the page is posted back: