Consuming a Web Service

We are consuming a web service designed on an AS400.  We are consuming this
via ASP.Net by defining a Service Reference.
We then use the following code


    wcfInput._PARMCUST = "   5709B"
    Dim wcfResult1 As WCSSHIPMNT.WCSSHIPMNTResult = wcfClient1.wcsshipmnt(wcfInput)

    DataGrid2.DataSource = wcfResult1._DSSHIPMENT

To bind the result to the datagrid.  

This works well, except I am not able to capture on the ItemDataBound event.  

I am not able to figure out how to bind this data to anything but the datagrid.
I would like it in a data adopter, or a data set.

Does anyone know how to do this?
LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
You do not bind to a DataAdapter or a DataSet. A DataAdapter is used to load a DataSet (or DataTable), and a DataSet is an abstraction of a collection of related tables (generally). What are you trying to accomplish by using a DataSet?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
I am not able to capture on the ItemDataBound event.  

What do you mean by this. ItemDataBound  always get fired after  DataGrid2.DataBind().

 Put a breakpoint on ItemDataBound   and see if code breaks there.
samic400Author Commented:
I want this data where I can use it,  where I can reference each field/data element individually or read thru it sequentially or sort it, then bind it to a control,  or select from it with a select statement
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

Yes then in that case DataGrid2_ItemDatabound  is a proper location. Proceed with my suggestion. Put a break point there( does code break onDataGrid2_ItemDatabound? ).

samic400Author Commented:
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)

I am then able to reference the data as  drv("FieldName")

end if

It does fire, I just don't know how to capture the data
OK does DataGrid has bound columns or also template coulmns?

If they are  Bound , you can read data like this:

e.Item.Cells(11).Text  '(column 10)

For a template column something like this:(If that cell contains a listbox)

Dim lst as ListBox

lst =e.Item.Cells(3).Controls(1)  'Gets the list box in coulmn 4 (assuming that cell has only 1 control inside it).

You may need to play with Cell and controls Indexs to find the correct location of the data you want.
samic400Author Commented:
before I load the data, I have to call another routine with the value of the cell and modify the data before loading the cell,  also I sometime check the value of the data coming in and then set a background color, so those options do not work,  How do I reference the data on the ItemDatabound event.
ItemDatabound happens exactly before data gets loaded to the grid.

data on itemdatabound are data in e. they are not on Grid yet so you should be able to modify them.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.