Solved, c#, <list> Consume

Posted on 2012-09-21
Last Modified: 2012-10-08
I have attached codes in wcf, and everything working fine.
I can bind the wcf servies by using the following codes(Test: GridView):
However, if I don't have anymore GridView, and I want to write those data
e.g. onto text file like response.write showdata + chr(13)

How can I do that?

protected void Page_Load(object sender, EventArgs e)
            InsuranceServices.DataLibs datalibs = new Insurance.InsuranceServices.DataLibs();
            datalibs.SessionString = "kudm0aab5kdn3r45mdlpfs2t1";          
            Test.DataSource = objService.GetInventoryListInflatable(datalibs);
Question by:solution1368
    LVL 35

    Expert Comment

    by:Miguel Oz
    Let me know which alternative you are after:
    - Save as xml file (Check:
    The advantage is that you can convert your text file back to List.

    - Save as text file (Is this a csv representation of DataLibs class?)

    Author Comment

    basically, I just need to get return value so I can import text file. Behind  the scene,
    i have itextsharp and it is very complex and I don't want to explain there.
    so I can't use your alternative way(link).
    LVL 35

    Accepted Solution

    I need more specifi information.
    Please provide details on how the text file will be filled, For example:
    - One line per object.
    - The line contains the csv representation of the object public properties.
    - Class declaration (DataLibs ) to identify which properties to convert.

    Basically you neeed to write two methods:
    - In DataLibs class, add a ToCsvString() method that returns the object as csv string. (data1, data2, etc.)
    - In your page, add a BuildCsvFile(string filename, List<DataLibs> list) method that saves the list to a text file. Interanlly it loops the list and call ToCsvString()  for every object and save it to the file.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now