SHARE
TWEET

Untitled

a guest Feb 21st, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <asp:DataList runat="server" id="myDataList">
  2.   <ItemTemplate>
  3.     <b><%# DataBinder.Eval(Container.DataItem, "Column from DataSource1") %></b>
  4.     <br />
  5.     <%# DataBinder.Eval(Container.DataItem, "Column from DataSource2") %>
  6.   </ItemTemplate>
  7. </asp:DataList>
  8.    
  9. DataTable customTable = new DataTable();
  10.         customTable.Columns.Add("Column1");
  11.         customTable.Columns.Add("Column2");
  12.  
  13.         DataRow drNew = null;
  14.         foreach(DataRow dR in 1stDataSource)
  15.         {
  16.             foreach(DataRow dR1 in 2ndDataSource)
  17.             {
  18.                 if(dR["ID"] == dR1["ID"])
  19.                 {
  20.                     drNew = customTable.NewRow();
  21.                     drNew["Column1"] = dR["Column1"];
  22.                     drNew["Column2"] = dR1["Column2"];
  23.                     customTable.Rows.Add(drNew);
  24.                     break;
  25.                 }
  26.             }
  27.         }
  28.  
  29.         myDataList.DataSource = customTable;
  30.         myDataList.DataBind();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top