ListView with internal records

I would like to have a webpage with a list of items for the user to send for 
processing.

When the user enters the page I usually would like to enter a couple of 
default items. Then it should be possible to edit, delete and insert items to 
the list.
After all editing is ready, the list can be sent for processing.

I found out the ListView control looked like a great candidate. I added a 
ListView and configured a corresponding ObjectDataSource. The 
ObjectDataSource calls a handler class that creates the default entities. It 
works fine so far.

But when I want to configure the Update, Delete and Insert commands I am 
stuck. All examples are related to items being stored in database between 
each call. But I don't want to store anything in database until the final 
list is submitted.

Is this possible? Can I have a grid with records only "stored internally in 
viewstate" and still allow editing?
0
Utf
2/15/2010 1:33:01 PM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

2 Replies
664 Views

Similar Articles

[PageSpeed] 21

Hi,

Regarding on your description, have you considered using a in-memory 
dataset/datatable to hold the items/records you want to 
manage(update/delete/insert) through the ListView(or other databound 
control)? Thus, you can store the datatable/dataset either in page's 
viewstate or SessionState(store in viewstate will cause the page's response 
size increase much. 

#Insert/Update/Delete operations on dataset
http://forums.asp.net/p/1156913/2234796.aspx#2234796

#How to bind GridView and DropDownList controls using DataTable object
http://www.devasp.net/net/articles/display/278.html

#ASP.Net Bind GridView to DataTable
http://programming.top54u.com/post/ASP-Net-Bind-GridView-to-DataTable.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and 
suggestions about how we can improve the support we provide to you. Please 
feel free to let my manager know what you think of the level of service 
provided. You can send feedback directly to my manager at: 
msdnmg@microsoft.com.


--------------------
>From: =?Utf-8?B?SmFrb2IgTGl0aG5lcg==?= <jaklithn@noemail.noemail>
>Subject: ListView with internal records
>Date: Mon, 15 Feb 2010 05:33:01 -0800

>
>I would like to have a webpage with a list of items for the user to send 
for 
>processing.
>
>When the user enters the page I usually would like to enter a couple of 
>default items. Then it should be possible to edit, delete and insert items 
to 
>the list.
>After all editing is ready, the list can be sent for processing.
>
>I found out the ListView control looked like a great candidate. I added a 
>ListView and configured a corresponding ObjectDataSource. The 
>ObjectDataSource calls a handler class that creates the default entities. 
It 
>works fine so far.
>
>But when I want to configure the Update, Delete and Insert commands I am 
>stuck. All examples are related to items being stored in database between 
>each call. But I don't want to store anything in database until the final 
>list is submitted.
>
>Is this possible? Can I have a grid with records only "stored internally 
in 
>viewstate" and still allow editing?
>

0
stcheng
2/16/2010 7:50:58 AM
On Feb 15, 2:33=A0pm, Jakob Lithner <jakli...@noemail.noemail> wrote:
> I would like to have a webpage with a list of items for the user to send =
for
> processing.
>
> When the user enters the page I usually would like to enter a couple of
> default items. Then it should be possible to edit, delete and insert item=
s to
> the list.
> After all editing is ready, the list can be sent for processing.
>
> I found out the ListView control looked like a great candidate. I added a
> ListView and configured a corresponding ObjectDataSource. The
> ObjectDataSource calls a handler class that creates the default entities.=
 It
> works fine so far.
>
> But when I want to configure the Update, Delete and Insert commands I am
> stuck. All examples are related to items being stored in database between
> each call. But I don't want to store anything in database until the final
> list is submitted.
>
> Is this possible? Can I have a grid with records only "stored internally =
in
> viewstate" and still allow editing?

Hi Jakob,

I think you can easily do this. On initial load, check viewstate and
create a new dataset if there is no data and bind the listview to the
dataset. If viewstate has already some data, retrieve the dataset from
there

if (ViewState["dSet"] !=3D null) {

System.IO.StringReader sr =3D new System.IO.StringReader((string)
(ViewState["dSet"]));
dSet.ReadXml(sr);

} else {

System.IO.StringWriter sw =3D new System.IO.StringWriter();

// Write the DataSet to the ViewState property.
dSet.WriteXml(sw);
ViewState["dSet"] =3D sw.ToString();

}

http://msdn.microsoft.com/en-us/library/aa287542.aspx
http://msdn.microsoft.com/en-us/library/aa287539.aspx

After that you should be able to work with listview as with a
database.

Hope this helps
0
Alexey
2/16/2010 7:59:29 AM
Reply:

Similar Artilces:

Windows.Forms.ListView.ListVewItemCollection.IndexOfKey function
Hi, How can I set the string "key" value that is the argument for the function Windows.Forms.ListView.ListVewItemCollection.IndexOfKey(string key) ? Niether the string value for public string ListViewItem.ImageKey { get; set; } or the string "text" argument for the constructor ListViewItem::ListViewIem(stirng text) work. Thanks, invegat On 12/12/2009 6:57 PM, invegat wrote: > Hi, > > How can I set the string "key" value that is the argument for the > function > Windows.Forms.ListView.ListVewItemCollection.IndexOfKey(string...

Bullshit error message
Hi I am trying to run the following code: - Dim db As Database Dim RST_Out As Recordset '#### the results table TTEMP_CampaignRunResults Dim RST_IN As Recordset '#### the Campaign Customer TM_CampaignCustomers Dim INT_Count As Integer '#### this holds the count of how many records are added '####################################################################################################################### '#### this is the final bit where we place all the records selected by the queries into the cam...

Bug in Visual Studio 2005 Listview object. Help!
I've found an obvious bug in VS2005 (VB.NET), in the Listview object. I desperately need a fix. To duplicate do the following: 1. Create a new Visual Basic Windows Application. 2. Add a Listview object and Textbox object to the Form. 3. Add a column to the Listview Column collection. 4. Set the Listview View property to Details. 5. Set the Listview FullRowSelect property to True. 6. Add the following code to the Form: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ListView1.Items.Add("aaa...

Trouble With Internal Emails
We have a process where our sales staff emails a request to a queue. The people watching the queue accepts the email then replies to it. This creates 4 entries in an account's activity history. I have read that this is "by design" (see below) - but am I the only one that has a problem with this? Sometimes people need to do this a couple of times a month - you can imagine how 4 emails at a time (when only 2 are needed) can add up. Suggestions? TechKnowledge Multiple Activity records are created for e-mail to a Microsoft CRM user Printable Link Email this link Document ID:...

OrderBy records in SubForm
I have: A F_Passages based in T_Passages. And SubF_Chunks based in T_Chunks. When change record in F_Passages the records in SubF_Chunks, don't appear ordered. In adition, the T_Chunks is ordered by Chunk in first place of this table and One Passage to many Chunks. Because the records in SubF_Chunks appear Record2, Record1, Record3,...(disordered), how is possible to order it in SubF_Chunks, please. Thanks in advance. an Sorry. I would like to put in AccessNewsGroups (?) an >-----Original Message----- >I have: > >A F_Passages based in T_Passages. >And SubF_Chunk...

Finding records with overlapping times
My table has an Case ID, date, start time and stop time. I need to be able count the records with overlapping times. This is an OR utilization application and we want to know how many cases we have going on at the same time. For example: Case 1 Start time 11:00, Stop time 12:58; Case 2 Start time 11:42, Stop time 12:28; Case 3 Start time 11:55, Stop time 12:10; Case 4 STart time 12:12 Stop time 13:35. Cases 1, 2 and 4 would be concurrent. But since Case 3 was over before Case 4 started, it would not be counted. I know very little VBA, but would really appreciate help with this. Thanks. ...

Creating an 'internal mail only' template
Hi Guys, I am attempting to create an internal email template within outlook 2002 for my department at work. The hope is that I can create an email template, which will not send if there is a non-company email address in the 'to:' field. For example if the company email ended: ‘@go4ever.com’ - I would like this template to only accept email addresses ending in '@go4ever.com' within the 'to:' field. Does anybody have any ideas how to do this? Can this be done by inputting validation code for the 'to:' field? If not does anybody have any in...

Open form to a particular record
Hi, I have a continuous form listing some employees. One of the fields displayed is the EmployeeID field. Is it possible to double-click a particular EmployeeID field on the continuous form and another form (called "frmEmployees") open and display the record for the employee that I double clicked? I tried the following code and the frmEmployee form opened but at the first record, not the record for the person I double-clicked in the continuous form. ********************************* Dim strWhere As String strWhere = "[EmployeeID] = """ & Me.[Emplo...

Cross Reference Records in a Table?
I have an application deployed to some users. It is a shell that we use over and over again for projects. We are running into a situation where the data we receive contains duplicate records. There is a unique identifier to each one, but they are for the same "customer". We are told that any time a customer has a change to their account they got a new record. We need to keep all the records, because their orders are tied to their unique id, but would like to be able to see from any one record, what other customer records they have. How would I construct this, and how would the e...

Listview Control with only vertical scrollbar
Could any one please suggest me how to create a listview control in Excel which has only vertical scrollbar and there is no horizontal scroll bar. I have a strange problem - A few listviews that have item of longer length do not get horizontal scroll bars and some which have only two character item have horizontal scroll bar although the size of both is same. Regards, Shailesh ...

Open form to specific record quits working
I have a customer search form that opens a specific customer order. Sometimes when I add a field or make a minor change to the customer order form, the customer search pulls a blank or new record. I delete the change I made to the order form but a blank record is still pulled. What can I do to fix this? Thanks Sorry, I meant to post this to Access. "Ron Weaver" wrote: > I have a customer search form that opens a specific customer order. Sometimes > when I add a field or make a minor change to the customer order form, the > customer search pulls a blank or new record...

One click from e-mail and the record opened. How ?
Hi, I create a case for example, and automatically it sends an e-mail to X persons with all the specs from that particular case. Of course it's create from a e-mail template. What I need to know is, in that template, can I insert a link, that will open a new window with the record of that case. (Record of the crm inferface for that case.) I've been told stuff about the c360 third-party software e-mail link. But at my view It's only to give an update about a specific case the person is working on. Which is not what I'm looking for. I want the specs of that case, and h...

Outlook 2003 & Printing Record of Attachment Filename
I understand that printing a plain text formatted message allows the filename of attachments to be printed as well. However it only prints the first 30 characters or so of the filename, and the file size if any space is left. Is there a way to expand the field where attachment filenames are printed so I can have an accurate record of attachment filenames? Eudora would do this painlessly by default, and would also include the full file-path of all outgoing attatchments. Andy No, you re limited to what it prints. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in ...

No Minimum Wage Balance master pay record exists for this employee
We received this warning message on the payroll build this week. Minimum wage is not an issue with our employees and this particular staff was set up exactly the same way as other staff. Has anyone else gotten this message? You might check the employee's Additional Information button to see if the Calculate Minimum Wage Balance checkbox got marked by mistake. -- BrianB "sandwest" wrote: > We received this warning message on the payroll build this week. Minimum > wage is not an issue with our employees and this particular staff was set up > exactly the same w...

New Record Problem when filtering
I'm using Access 2003 and have what at first seems like a common problem. On one of my forms if a user hits the scroll button on the mouse, it scrolls to a new record which then causes problems. I don't have sufficient rights to deploy a dll file so I got around it by changing the AllowAdditions setting to "No". Theoretically that should have worked and indeed it does if I open up a form directly. But in this database I often open up a form to a particular record using the "Where Condition" argument of the DoCmd.OpenForm command. When I do that, it opens...

Avoiding Redundant Records
It is my understanding that surrogate keys are generally recommended to ensure uniqueness of records. Is it not true that using surrogate keys implies taking extra precautions to prevent duplicate records? I mean, with surrogate keys there is nothing to prevent the proliferation of multiple records all containing the same data, but each having a unique key. I would appreciate your help with this in the following context: AGREEMENTS AgrmtID (PK) InsuredID Agrmt fields… CERTS CertID (PK) AgrmtID ProducerID Cert fields… POLICIES PolicyID (PK) InsuredID PolicyTypeCo...

In Word 2000 how do I undo Skip Record If
In creating my first mail merge file I thought the "Skip Record If" might work for me. I will be running this mail merge on a monthly basis and used a date in the Compare To: box which will only work for the current month. How do I undo the "Skip Record If" so I can sort my data through the recipient list? -- Thanks, ChrisR Your post in the mailmerge.fields newgroup has been answered. Please do not post the same question separately to multiple newsgroups. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my se...

Macro Action Fails on Duplicate Record
I have a form with a subform whose visibile property is set to no. I have a macro that runs when a choice is made in a combo box that sets the visible property of the subform to yes when the selection=2. The macro sets the visible property of the subform to no when the selection does not =2. This is how I have the macro: Condition: [Appearance]=2 Action:Set Value Item: [Forms]![Appearance Request Basic]![OffSiteApp].[Form].[Detail].[Visible] Expression: True Condition:... Action:StopMacro Condition:(this I left blank) Action: SetValue Item:[Forms]![Appearance Request Basic]![OffSiteApp...

Trying to update multiple fields in the same record (same table)
I am currently creating my second database using Access 2003. The first, while still leaving me with a few headaches, did not seem to give me the same problems as this project. I am trying to create a database to help keep track of students standardized test scores. To get the scores I had to download each individual test (for each grade level) for each year in Excel. (Reading Total, Composite, etc.) Or, 12 total sets of scores. I was able to create a table for student information and am now stuck with trying to "merge" the actual test scores into a separate table....

create an internal forum
I have been tasked with creating an internal discussion forum on an Exchange 2003 server. I am new to this and would appreciate any advice or tips that can be shared. I have been searching the internet for days and cannot figure this out. thanks in advance How fancy do you want to make it? You could just use a public folder and train users to sort messages by 'conversation'. Or you could create the public folder and build a web app with .net, or use sharepoint portal. "jason" wrote: > I have been tasked with creating an internal discussion forum on an Exchange &g...

Error 3021 but records exist
Hi all, When I try and open a report I keep getting the 3021 error. It's specifically one group of records (vehicle bookings in the 'Area Office Pool'), selected thru the second of two combo boxes on a form. The first combo box filters by suburb. Yet when I run the query (which is the recordsource for the report) which is based on the combo-box selections on the form, I get the 94 records in the query! If I change the specific group of records to say, 'Smith Street Pool', the report opens fine! Any clues anyone? Pete ...

Export Query into Files of 60k Records
I have a Query that returns a lot of Data and I would like to have it Export to a Text File with No More than 60,000 records in each file. So if my Query contains 200,000 records I would like the Routine to break it up into 4 text files, 60,000 records in 3 files and 20,000 in the fourth. What would be the code for this? Any help is greatly appreciated. -- Brian Conner Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/201001/1 If you need to address which row goes to which file as part of the querying logic (as opposed to cont...

mailmerg current record from a Access form to Word
Hi, I'am having a problem with merging just one record with a Word doc. In Access i have a multipage (3 tabs) displaying just one record. On the first page (tab) i have a combobox which is used to select a record from the database. All the fields(75) are then displayed on the pages(tabs) of the multipage. I have a button called "merge" with which i would like to be able to; 1. Open word and open a certain letter (c:\data\DBM\testletter.doc) in which i have put mergefields (I connected the letter to the database of the form) 2. Then merge only the current record (...

combo box to update record via form
I have a combo box that displays the EmployeeID, FirstName, and LastName from the Employee Table. The user is to pick the employee and I want the ID stored in the DataEntry table. The combo box pulls all of the employees from their table via the following query associated with the combo box SELECT tblEmployeeInformation.[Last Name], tblEmployeeInformation. [First Name], tblEmployeeInformation.[Employee ID] FROM tblEmployeeInformation ORDER BY tblEmployeeInformation.[Last Name]; I have the bound column for that combo box set to 3 yet the table always updates with the employees last name. How ...

Previously used/opened record
I would like to have a button to hit to get me to my previously opened/used record. Can anybody please oblige me with some code to achieve that? Thanks, RF. Define "previously"... No, seriously, until you can tell Access HOW to find the "previous" record, Access won't know what to do. By "previously opened/used" do you mean "most recently" (a single record) or ALL records that have been opened/used. If the latter, since when? If a record is only "opened" (?looked at but not changed?), does that count? What do yo...