2014-10-17 4 views

ответ

0

Вот код VB.Net позади.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
    If Not IsPostBack Then 
     Dim appSettings As NameValueCollection = ConfigurationManager.AppSettings 
     Dim DT As New DataTable 
     Dim DR As DataRow 
     Dim AppKey = New DataColumn("AppKey", Type.GetType("System.String")) 
     Dim AppValue = New DataColumn("AppValue", Type.GetType("System.String")) 
     DT.Columns.Add(AppKey) 
     DT.Columns.Add(AppValue) 
     For Each Key In appSettings.AllKeys 
      DR = DT.NewRow() 
      DR("AppKey") = Key 
      DR("AppValue") = appSettings.Item(Key) 
      DT.Rows.Add(DR) 
     Next 
     Dim DS As New DataSet() 
     DS.Tables.Add(DT) 
     AppSettingKeys.DataSource = DS 
     AppSettingKeys.DataBind() 
    End If 
End Sub 

Вот страница:

<table> 
     <asp:Repeater ID="AppSettingKeys" runat="server"> 
     <ItemTemplate> 
      <tr><td class="table-left-class2"><%#Eval("AppKey")%></td><td><%#Eval("AppValue")%></td></tr> 
     </ItemTemplate> 
     </asp:Repeater> 
    </table>