C# - Save Updated Object In Generic List?

Aug 30, 2010

I am trying hard to update a business object inside a List<>.

I am using a checkbox list

When a checkbox list item is clicked I check if it exists, if yes I mark it as Dirty (means the user unchecks an item)If not, I add a new item to the list (means the user clicks a new item)and store it in view state

How do I update the Generic List with the Dirty Object ?
On form update, do I foreach and make separate lists of dirty and new objects to send to DB layer or would you recommend any other way ?

Here is my code.

protected void cblExclusions_SelectedIndexChanged(object sender, EventArgs e)
{
if (cblExclusions.SelectedIndex != -1)
{
ftExclusions myExclusion=new ftExclusions(); // Business object

[Code]....

View 1 Replies


Similar Messages:

Finding An Object In A Generic List Of Type?

Dec 9, 2010

I have a class Trans, with properties siteID and TID. I have a generic list of this class, TransList = list(Of Trans).

Now I want to find the Trans in TransList where the siteID is 3 and the TID is T1. There will only be one record. I want to then update this Trans in the TransList (so I need a reference to the Trans). I am trying to do the following, but it doesnt like it.

[Code]....

View 2 Replies

Web Forms :: How To Sort List-generic Object By Two Parameters

Mar 16, 2011

sort List-generic object by two parameters

View 1 Replies

State Management :: Casting Session Object To Generic List Fails?

Feb 27, 2011

i'm having a gridview with textboxes and i'm allowing user to enter all the textboxes and when submit button is clicked, I'm constructing the Object and adding all the rows to LIST class.,After that i'm putting that LIST elements in a session. Everything is fine, But when i try to cast the session object to LIST type and pass it to XML serialization, I cannot see the elements in the list and it is showing LIST as NULL. I can see the generated XML string with ROOT and my classname as attributes without no data.

Here is the below code:

[Code]....

View 16 Replies

State Management :: Cache System.Collection.Generic.List Object?

Aug 22, 2010

I need to cache System.Collection.Generic.List object with expiration time

var Root = from feed in feedhotel.Descendants(ota + "HotelContent")
where (feed.Attribute("HotelCode") != null)
select new xmlhotel()
{
};
return Root.ToList();

Is it possible to cache Root.ToList() for some time....

View 1 Replies

Getting A Value After Gridview Row Updated / Object Reference Not Set To An Instance Of An Object

Jun 29, 2010

I have a gridview that shows a list of questions. Only one field is editable and if the information has been edited an email is sent to a specific "destiny". All works fine but when I try to get the Question ID in my SendEmail function (using Findcontrol) I get "Object reference not set to an instance of an object." How Can I get the Question ID?

My sqldatasource:

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:conn %>" SelectCommand="SELECT Questions.QuestionID, Questions.Name, Questions.Question, Questions.Destiny, Questions.DateQuestion, Questions.Answer" UpdateCommand="UPDATE Questions SET Destiny = @Destiny WHERE (QuestionID = @QuestionID)">
<SelectParameters>
</SelectParameters>
<UpdateParameters>.....

View 2 Replies

Web Forms :: Adding List Items To Drop Down Control From Generic List?

Feb 6, 2010

I have the following Students class:

[Code]....

I need the 1 since it's a foreign key in another table. For the life of me, I can't get this to work like this.

View 7 Replies

Trying To Use .Contains For Generic List

Jan 3, 2011

I have a list view control. Each row within it has a rowid and a textbox where a note(user enters relevant info to that particular record) is entered. On a paging event I store the rowID and the note text in a generic list for retrieval if the user pages back later on. Goal here is to keep the text the user has entered. (see the code below)This generic list does in fact get populated correctly when I go to the next page currently. I can see this in Visual Studio. So now, when the user goes back to the first page I want to run a test within my Listviews ItemDataBound event. I want to see if the row ID being tested is part of the generic list. If so, I then want to take the corresponding note that is also within the list and bind it to the text box. However, I don't know how to write the correct conditional for this and how to bind the textbox if the conditional evaluates to true.

View 1 Replies

Using .net Mvc 2 And WCF - Passing Generic Object To The Service Call?

Mar 11, 2011

[DataContract]
public class UserCertification
{
...
}
[DataContract]
public class UserPhone
{
...
}
[code]...

View 2 Replies

Web Forms :: Dropdown List Not Getting Updated?

May 28, 2010

I have a web page, contains dropdownlist loading it with customers table using SQL datasource.

In the same web page i am creating a new customer, on clicking customer add it is creating a new row in customer table but the Customer Dropdown list is not getting updated.

I have added dropdown.databound() in the CustomerAdd button click event after creating the customer in the table.

View 5 Replies

Web Forms :: Drop Down List Don't Get Updated?

Aug 17, 2010

I am trying to write a web page where i have to select an item form a drop down list.

I am using linq to sql to get the data from the database.the strange thing is that i can register the data to the drop down list but when i select one of them the drop down list lets me to the first item. I set post back = true because i want to update the page every time an item get selected. I wrote a really simple code to check what was going wrong but still...no success. Below i am bringing the code i wrote.

.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication7.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

[Code]....

View 8 Replies

Merge To Generic List?

Apr 7, 2010

I have two generic list with Hotel class object. Both List contains hotel ID. I want to retrieve common hotel id from both Hotel List and assign to new HotelList.I have done following code for that but any other sort way to implement this kind of functionality.

[Code]....

Note: I dont want to use Linq because I am working on framwork 2.0

View 1 Replies

C# Generic List And ASP Repeater Fun

Aug 4, 2010

I'm trying to render out some images on an aspx page. Error I'm getting in the code below is:

DataBinding: '_Default+ImageThing' does not contain a property with the name 'FileName'.
public class ImageThing
{
public string FileName;
}
private void DisplayThumbnailImages()
{
ImageThing imageThing1 = new ImageThing();
ImageThing imageThing2 = new ImageThing();
imageThing1.FileName = "asdf.jpg";
imageThing2.FileName = "aaa.jpg";
List<ImageThing> imagesToRender = new List<ImageThing>();
imagesToRender.Add(imageThing1);
imagesToRender.Add(imageThing2);
Repeater1.DataSource = imagesToRender;
Repeater1.DataBind();
}

here is the aspx:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "FileName")%>
</ItemTemplate>
</asp:Repeater>

View 3 Replies

MVC :: Generic List In Model?

Jan 19, 2011

in my model there is a List.

public class InvoiceModel{
public int InvoiceID { get; set; }
public int Date { get; set; }[code]...

for create view i can use Html.TextBoxFor(m => m.InvoiceID) and for Date.but how can i fill List?and how can i use global for this list as Shopping cart?

View 6 Replies

AJAX :: Dynamically Updated List On Page?

Feb 3, 2010

I have a long running asynchronous process which returns a total of around 10-100 results over a 5 minute period. I want to update the page with the progress of the job and also show each result on the page in a list that grows dynamically as results are returned, all without any postback or page refresh.

View 6 Replies

What Is The Easiest Generic Way To Save Form Data And Retrieve It When The User Navigates Back To The Page

Feb 17, 2011

What is the easiest way to save form data and retrieve it when the user navigates back to the page?

We have an application process that consists of several web forms. If the user clicks to go back a step we would like to auto-populate the fields. I am assuming there is a common generic way to do this without having to mess with individual controls - what is it?

View 4 Replies

Diffrence Between Array And Generic List?

Aug 17, 2010

Can any one can describe the main diffrence between the array and generic list.

View 6 Replies

Minimum And Maximum Value From Generic List?

Apr 7, 2010

I have one Hotel class that contains many properties. When I retrieve all hotels data from database, I store them in Generic List object.Now what I want that I have two properties called LowestPrice and HiestPrice. I want to get Minimum(LowestPrice) and Maximum(HiestPrice) from generic list directly.

Something like HotelList.Min();
Right now I have following logic implemented in my project, but I dont want to use foreach loop.

[Code]....

View 6 Replies

Populate A TreeView From A Generic List?

Aug 1, 2010

I have a list of Categories which I need to bind to a TreeView control in WPF and I can't find a working tutorial or get it working.My Category class consist of (ID, Title, ParentID). If the Category is a top level category the parentID is null.Can anyone sow me how to bind this to a treeview?

View 3 Replies

ADO.NET :: Enumerate A Generic List Using LINQ?

Nov 23, 2010

I have declared a simple class

[Code]....

And Pass some values to it :

[Code]....

Then I use Linq to select rows :

[Code]....

How I can enumerate it?! I used this, but it has error

[Code]....

View 3 Replies

Datalist To Bind The Generic List

Jun 25, 2010

I am using datalist to bind the generic list. On databind() command I am getting error "nable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

View 3 Replies

Bind Generic List To DropDownList?

Feb 22, 2011

I am trying to bind generic list to DropDownList an i am not sure how to continue.

[Code]....

View 3 Replies

Text Box Binding With Generic List?

Aug 31, 2010

I am working in asp.net 3.5 page, where I want to bind a textbox with generic list data. And I have Previous & next button. Which will show the record in textbox.

I don't want to go in db again and again.

View 6 Replies

Doing Group Duplicates In Generic List

May 25, 2010

i have these values in my generic list:

Product Name ItemCount Additional Info
Brioche & Jam 2
Almond Croissant 4
Mixed Salad(v) 20 No Onions
Mixed Salad(v) 5

What i am trying to do is group the duplicates so now the list would look like this:

Product Name ItemCount Additional Info
Brioche & Jam 2
Almond Croissant 4
Mixed Salad(v) 25 No onions

View 1 Replies

ADO.NET :: Generic List Convert To DataTable

Sep 20, 2010

I have a GenericList and i want to convert that to DataTable My code is here

[Code]....

I am getting Count in "objFinOpRegs". But i want to convert "objFinOpRegs " to DataTable.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved