tags:

views:

39

answers:

2

I present a List from WCF and client receives DocTypes[]. No prob there.

current situation is where client my only accept 1,2 out of 100 DocTypes. What is best way to condense the [100 ] to only 2?

I have this code for marking what user checked off of grid.

foreach (GridViewRow rowItem in gvDocTypes.Rows)
            {
                chk = (CheckBox)(rowItem.Cells[0].FindControl("chk1"));
                if (chk.Checked)
                    DFO[y].Process = true;
                y++;
            } 

This is the schema for the data collection:

 [System.NonSerializedAttribute()]
        private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
        private int DocTypeGroupField;
        private System.Guid DocTypeIDField;
        private string DocTypeNameField;
        private int DocTypeNumberField;
        private string ErrorMsgField;
        private bool ProcessField;

Best practice I think is to name a clone of this object and add as needed in my iteration through the grid. I just can't get my starting point in a new array?

Have tried this:

Service.DocTypes dfo = new Service.DocTypes() ;
Service.DocTypes[] DFO = (Service.DocTypes[])Session["oDocTypes"];
Service.DocTypes[] oDFO = DFO.Clone();  

What am I missing?

TIA

Stephen

+1  A: 

If you use Add service reference to create service proxy for you, you can define what type of collection should be generated. Default is System.Array but you can choose System.Collections.Generic.List.

Best regards, Ladislav

Ladislav Mrnka
A: 

In Visual Studio, right-click the added reference under Service References, then choose "Configure Service Reference". Change "Collection Type" from "System.Array" to "System.Collections.Generic.List" and you'll then be able to treat them as lists from the client.

Toby J