How to persist data in the object n memory after fetching it once from database and use it with linq

Hi,
I have some data from the database around 8 to 10 records .
These records are interrelated and I need to show cascade drop down.
I want to get the records from the database using c#.
And then based on certain events on the page want to use linq over the same data without having to get the data from the data base again.
i.e 
ProductName
Product Plan
Product type
Monthly
Annually
pordA
Gold
Individual
1
5
pordA
Gold
Spouse
2
6
pordA
Silver
Individual
3
7
pordA
Silver
Spouse
4
8
Prod B
Platinum
Individual
5
9
Prod B
Platinum
Spouse
6
10
Prod B
Gold
Individual
1
5
Prod B
Gold
Spouse
2
6
pordA
Silver
Individual
3
7
pordA
Silver
Spouse
4
8
pordA
Platinum
Individual
5
9
Now on page load I want product name in drop down.
Based on the productName selected i want to show Product Plan in another drop down and based on prduct plan want to show prduct type in drop down and then the annual and monthly in drop down.
I want to get all the records of  prod A and then using  linq to object  load the drop downs instead of running query to database.
How can I keep the records available across the function calls.
Regards
Vinod

This is mostly a ASP.NET question. You get better answers if you post it in ASP.NET forum.
This is my answer:
Session is not a suitable choice, since each user will have a duplicate of the data. Cache is a better option.
You can put something in Cache option and retrieve it from Cache similar to using Session. This is the manual method of caching and management of the cache content is on yourself.
public List<Product> GetAll()
List<Product> products = null;
if (Cache["Products"] == null)
DataSet data = RetrieveProducts();
products = ConvertProductsDataSetToObject(data);
Cache.Insert("Products", products, null, DateTime.Now.AddMinutes(30), TimeSpan.Zero);
else
products = (List<Product>)Cache["Products"];
return products;
When putting something in the cache, you should set its expire time. But one thing that is more important over this is to clear the cache when your data is changed in the data store (e.g. database).
public void UpdateProduct()
// update product in the database
// clear the cahce, so that the next request for Products, receives a fresh copy of the data
Cache["TestItem"] = null;
Other than using cache manually, there are also some helper funcationalities that manage cache automatically for you, based on the technology you use (ASP.NET Web Forms or ASP.NET MVC). For example in ASP.NET Web Forms you can ask ASP.NET Web Forms engine
to cache the output of a User Control automatocally by adding OutputCache directive to the user control. In ASP.NET MVC you can you [OutputCache] attribute and apply it to actions.
[OutputCache(Duration = 86400, Location = OutputCacheLocation.All)]
public ActionResult Index()
var model = ProductBL.GetAll();
return View(model);
Also, there is a concept named cache dependency, by which you can specify a dependency for the item being cached. When the condition is met, the cache automatically invalidates and clears.
There are three kinds of cache dependency:
Item dependency: make cached data dependent on another cached data
File dependency: make cached data dependent on a file
Sql dependency: make cached data dependent on the result of a SQL query

Similar Messages

  • The recent upgrade for i-tunes prevents me from adding and using the Field, "Show". How can I add this field in i-tunes?

    The recent upgrade for i-tunes prevents me from adding and using the Field, "Show". How can I add this field in i-tunes?

    Hold down shift as you right-click > Get Info to get the old style dialog box.
    tt2

  • How To Question: Can I fetch a row from database and show it as link,on click of thi

    Hi:
    I am trying to get a row set from database, display it as link/ hotspot then upon clicking of this link to delete that particular row from the database.
    I would appreciate if someone there could give some pointers.
    Thanks in Advance
    Ajith
    null

    In each row of your table, you need to construct a HREF that submits to a servlet (or JSP) with a GET parameter that references the primary key for that row, e.g.
    <td><a href="delete.jsp?rowid=15">Delete</a></td>The delete.jsp can execute the delete and then forward to the display.jsp to redisplay the resultset after requerying the database.
    John H.

  • I keep getting the same emails twice, after I've deleted from device and read on desktop!

    While at work, I usually read my email on my computer, but I still get them on my BB, which I delete right away. However, even after it's already been read on my computer and deleted from my Curve, I end up with another alert for the same email, and the email as unread in my Curve inbox.
    How can I make that STOP? I don't need to be told more than once that I have a new email, and even less so if I've already read it! 

    is the email imap, pop, owa/exchange?
    do you have redirector installed (in DTM is there an email settings icon)
    who is your carrier?

  • How to see who deleted the Object

    Hi Gurus
    Would you please advise if some data target or transformation is deleted from the BW system how to know who deleted the objects?
    Thanks

    How to see who deleted the Object

  • How do I set up the "Objects and Attachments"

    Hi .... I'm new at WorkFlow (and SAP for that matter) and have inherited a WF that is already built.  In several of the steps I can see "Objects and Attachments" on the work item screen where a User can click to be directed to a transaction. For example, on one screen the User can click on "Incoming Invoice: 5105601690" to be directed to the Invoice Display Screen that is populated with information for that particular invoice (5105601690).
    I am looking at the WF using TCode SWDD and cannot figure our how the original developer set this up.  So my question is ..... for a particular WF step, how do you set up the "Objects and Attachments: area so that the User will be directed to a particular transaction when he/she clicks on it.
    Thanks in advance, and sorry for such a "juvenile" question.
    Dan A

    Thanks for your reply Rajkumar,
    I am looking at the screen you have directed me to.  Business object is BUS2081 (actually it is ZMMWBS2081 which is a customized version BUS2081) Method is "Display" and Attribute is "InvoiceDocNumber".  How do I know by looking at this that "Display" means Display Invoice?  What if I wanted to display the PO instead?
    Thanks for the "spoon feeding".
    Dan A

  • How to insert data into the mysql table by giving as a text file

    Hi,
    Any one know's how to insert data into the mysql table by giving as a text file as the input in JSP.Please respond ASAP.
    Thanks:)

    At least you can try StringTokenizer to parse your text files. Or download a text JDBC driver to parse your files, for instance, HXTT Text(www.hxtt.net) or StelsCSV(www.csv-jdbc.com).

  • How can i access all the objects of one schema from another schema

    Dear All,
    How can i access all the objects(Tables,Views,Triggers,Procedures,Functions,Packages etc..) and do the modifications of one schema from another schema (Without using synonyms concept).
    Thanks in advance,
    Mahi

    First of all, synonyms only help you easy reference the object. It doesn't have any implication of object privilege.
    As long as you have proper privilege on target object. You can access it with or without synonyms.
    Assuming you have proper privilege of objects, you can use following command to assume schema owner.
    ALTER SESSION SET CURRENT_SCHEMA = Schema_owner

  • How do i keep only the name of a month in a cell in Numbers and not have it auto fill the date and time?

    how do i keep only the name of a month in a cell in Numbers and not have it auto fill the date and time?

    Hi JN and Barry,
    Barry wrote:
    The second case may not be included in the available D&T formats in Numbers 3
    For my region, the Date & Time data formats include month.
    The Date Pop-Up
    This may not be the case for all regions.
    Remember that the month is only the display, and the Full Date & Time is still there. If I change the format to reveal what is behind the curtain:
    Regards,
    Ian.

  • HT1766 please help...we updated ipod2 4.1 to IOS 5.1 at itunes...after it was finished only the contacts were restored...not the music & videos...we found the backed up data in the pc(windows 7)after entering %appdata%..pls help how to restore..thanks!God

    please help...we updated ipod2 4.1 to IOS 5.1 at itunes...after it was finished only the contacts were restored...not the music & videos...iwe found the backed up data in the pc(windows 7)after entering %appdata%..pls help on how to restore...we will appreciate it very much....thanks! God bless!

    The iPod backup that iTunes makes does not include synced media like app, music and videos. Thus, you wll have to resync those back to your iPod.
    If necessary you can redownload iTunes purchases by:
      Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • How to process data in the past based from data in the present

    hello guys,
    i have a problem in my labview programs. how to process data in the past based from data in the present ?
    i have a formula self-organizing maps
    this formula is looking for D1, D1 is neuron index that will be searched for the smallest value.and the result are D1=2 ,D2=5, D3=17 from calculating with formula  .it means the smallest value is 2, "2" from weight [2 2] in file attached.
    and then it will be in other formula
    it mean [2 2] + 0.5 ( [1 1]-[2 2] ) = [1.5 1.5]
    and the weight will be  [1.5 2 2 ] in matrix
                                              1.5 3 5
    I would appreciate any input/help on solving this
    thanks
    Attachments:
    dika.vi ‏16 KB
    weight.txt ‏1 KB
    data .txt ‏1 KB

    Hi Ronny Hanks,
    Moving your records from internal table into the database table depends upon various scenarios :-
    1. If you use INSERT statement.
    INSERT <database_table> FROM TABLE <internal_table>.
    But in this case, you need to make sure that you don't have any duplicate entries in your internal table that violates data entry into database table, else you will get a dump.
    INSERT <database_table> FROM TABLE <internal_table> ACCEPTING DUPLICATE KEYS.
    In this case, you are forcefully inserting duplicate records into your database table which may lead to data redundancy in your database table.
    2. If you use UPDATE statement.
    UPDATE <database_table> FROM TABLE <internal_table>.
    This will update the existing records in your database table from the internal table.
    3. If you use MODIFY statement.
    MODIFY <database_table> FROM TABLE <internal_table>.
    This statement works both in combination of INSERT & UPDATE statements.
    Existing records (in database table) will be eventually updated/modified and new records (not in database table currently) will be successfully inserted into the database table.
    Hope this solves your problem.
    Thanks & Regards.
    Tarun Gambhir.

  • How to get data on the next page in case of templates if data is more ?

    please tell me how to get data on the next page while i m using template in my first page , if data is more howw it can be displayed on the next page ?

    HI Asim,
    template is fixed we  it can't be expand . u can better to use table line it can automaticlly expending if data is more ... u can create one more page like page 2 and create a window for entire second page ..then assign it in first page (next page page2).
    regards
    kiran kumar.

  • How do I get to the Object Definition Editor?

    I know this has got to be a beyond basic questions and I feel kind of stupid for asking, but how do I utilize the SDK? I am new to working in a Java environment and it's a bit confusing to me at times.
    So, I downloaded the SDK. I know how to add new QPACS in Workflow designer, but, for example, how do I get to the Object Definition Editor?
    Thank you,
    Jennifer

    Hi
    The 7.0.0 version of the ODE was missing a couple of jar files, and this caused some of the functionality to not work properly, specifically "synchronize". (This may have been fixed in later versions, I haven't checked.)
    In order to fix this, copy all .jar files from the WF designer's lib directory to the ODE's lib directory (no overwrite if the file already exists).
    Howard
    http://www.avoka.com

  • How to insert data to the specified row column of the multi column list box

    Hi All
    How do i insert data into the specified column of the multi cplumn list box?
    I have a table that containsall station nos and name.Then another table contains the data the various stations having at  for 24 hrs.That is 12 am to 11 pm.
    And i want to display each stations details as follows using a multi column list box/table
    My stationinfo table
    stnno   stnname......................
    s1           stn1
    s2            stn2
    s3             stn3
    The other table
    stnno      sysdatetime       data
    s1             12am                   1
    s2              12am                   4
    s1               1  am                 2
    So the station s1,s2.... will have data for 24 hrs.
    And i want to display it as follows using a multicolumn listbox
    stnname        12am   1 am ......................................11pm
    s1                   ...................
    s2                 ........................
    What i have in my  mind is to get all station nos
    and in a for loop get the station's data from 12 am to 11 pm
    or
    select every statios data for each hor.But in this case i have to query the database 24 times.So i dont think its a good way.
    Or any other better query available?
    Can anybody suggest me a good idea?
    One more thing...how to insert data into the specified field row or column of a multi column list box?
    Thanks in advance

    hi
    i want to know,,can u say ur need clearly...and i attached two image u see that one
    Indrajit
    | [email protected] | [email protected] .
    Attachments:
    station.JPG ‏35 KB
    station2.JPG ‏79 KB

  • How to reset data for the company code 1000

    Hi Gurus,
    I am practicing SAP SD on a sandbox server as am learning it.
    But i see that the standard data for the company code 1000 has been altered by previous users and most of the standard setttings have been changed.
    Due to this am having a lot of issues while configuring a new company code by copying it from 1000.
    Please help me reseting the data for the company code 1000 so that it will be easier for customizing and learning.
    Regards,
    Harish

    Hi Harish,
    Follow the step given below
    SPRO --> Enterprise Structure --> Definition --> Financial Accounting --> Edit, Copy, Delete, Check Company Code
    A pop screen will appear which will give you two options
    1)  Copy, delete, check company code
    2)  Edit Company Code Data
    Select option one
    On next screen --> Click at " Check org. object" or press F8 --> It will ask your company code --> enter your company code 1000 --> Enter
    It will check all the related table and if it find any discrepency
    then it will show you one pop up screen
    Errors in
    foreign key dependencies
    Do you want the error log
    displayed now?
    Click at Display now --> correct all the fields which are wrongly maintained.
    Hope this helps
    Regards,
    MT

Maybe you are looking for

  • How do i consiolidate my photo masters in Aperture 3. I have a vault from Aperture 2 but 3 will not access it.

    I use Aperture for photo editing and management and had been working in Aperture 2. I created a vault on my external HD to store my masters in. I had done something to my computer (not sure what) and ended up wiping my internal HD and reinstalling al

  • 790FX-GD70 won't POST - 3 beeps & diagnostic LED "2e"

    Hi, After a second or two of rapidly displaying various hex values, the POST_LED stops at "2e" (not documented in manual; can't find on MSI support site) and the system issues 3 beeps  (1 long and 2 short, also not documented in manual or online for

  • Adobe Photoshop CS3 has stopped working... HELP?

    Everytime I try to make a GIF, and I select the length of the video, and press okay, a box comes out saying: Adobe Photoshop CS3 has stopped working. I've tried the "CTRL-ALT-SHIFT," but it doesn't work! Please help? ): I make a GIF like this: File-I

  • OC4J Wireless standard apps missing

    Hi all, I got the following error in my opmn log. Checking the OCS4J_Wireless APPS in EM confirming that all the standard OC4J-Wireless apps are missing, I guess some of the developer when trying to redeployed their customer apps hv accidently delete

  • Most Compatible Format for DVD Players

    I am trying to burn a project on some dvds. I have an external burner, and good media. I want to make sure that I am making it as compatible as possible, however. Right now, what I am doing is I have exported the project to full quality dv and am the