SharePoint: DataView How to Bind the main slave table data set by Web Service

xiaoxiao2021-03-06  84

By Ben

Working with The Data View Web Part Microsoft® Office FrontPage® 2003 Author: Ben Msn: Benjamine65@hotmail.com

How to use DataView call XML Web Services

How to display the father and son from the table

l Design goals:

Data View Binds the data set returned by the web service, displays the parent table, and the current record of the parent is estimated as condition, nested display sub-table

l Data structure (the following example is as an example of the Northwind sample database of SQL Server 2000):

l Sample Web Service:

If you have: http://localhost/aspnetsample/service1.asmx web services, where key code such as:

[WebMethod] public DataSet GetDataSource (string TableName) {DataSet ds = new DataSet ( "DataSetTables"); DataTable dt = new DataTable (); DataTable dtCus = new DataTable (); // sql dt = SqlHelper.ExecuteDataset (ConnectionString, CommandType .Text, "SELECT TOP 100 * ORDERS"). Tables [0]; DT.TABLENAME = Tablename; DTCUS = SQLHELPER.EXECUtedataset (Connectionstring, CommandType.Text, "SELECT TOP 100 * from customers"). TABLES [0] DTCUS.TABLENAME = "CUSTOMERS"; ds.tables.add (dt.copy ()); ds.tables.add (dtcus.copy ()); return ds;}

l Adding Data Source Catalog using FrontPage 2003:

1. Open Task Pane. Drop-down menu View -> Task Pane or Shortcut Key Ctrl F1, select Data Source Catalog in Task Pane, Expand XML Web Services and click Add to Catalog ...

2. In the pop-up Data Source Properties window, fill in the general page, give the current data source, for example: getDataSource; Fill the Source page content, service description location is http://localhost/aspnetsample/service1.asmx? WSDL, After OK, Connect Now! If the web service is correct, you will display the relevant service name, Operation, etc. in Connection Info, we now choose getDataSource in Operation, set the interface parameters of getDataSource; finally set the login page Login Method. After the completion is OK, the icon of getDataSource will appear under XML Web Services.

3. Drag GetDataSource to a web part zone in the page

4. Customize Data View.

4.1. Insert a column and place the cursor in the newly collected cell. Reconnect to the Data View's Data View Details panel, and select the Customers node, then Insert SubView 4.2. Set the association relationship. At this time, Customers record All displayed in the new column showing the Data View of the ORDERS record, it has not been displayed according to CustomerID display associated Customer record

So now you need to implement the associated filtering by modifying the XSL of the Data View.

analysis:

Click Data View GetDataSource to switch to the Code view, find the key XSL statement, such as:

This can be seen that the subtoms Customers are defined as an XSL: template name = "DVT_2", I can pass the Customerid as XSL: Param to XSL: Template as filt conditions

1) Add XSL: Param

Modify as follows:

Find DVT_2 Template definitions:

Table

Add XSL: Param:

Table

2) Apply XSL: PARAM and implement filtration

Will

Table

changed to:

Table

Now all steps are completed, you can browse in IE:

转载请注明原文地址:https://www.9cbs.com/read-107800.html

New Post(0)