can you kindly help me load my gridview with data from appsetings.xml . the gridview must have the following three columns(key,value and description)

here is my appsettings.xml.

<?xml version="1.0"?>
<configuration>
  <Global>
    <FromEmail value="test@uiplay.com"
               description="From Email Address Name" />
    <AdminEmail value="cmckowen@gmail.com"
                description="Admin Email Used for Admin Test and Unsubscribe Comments" />
  </Global>
  <Data>
    <!--<Connection value="server=localhost;database='PolicyNet';uid='sa';pwd='sa123!'"
                description="Default Database Connection String" />-->
    <!--<Connection value="server=wormwood;database='PolicyNet';uid='PolicyNetTest';pwd='PNet123!'"
                description="Default Database Connection String" />-->
    <Connection value="server=196.14.77.139;database='PolicyNetTest';uid='PolicyNetTest';pwd='PNet123!'"
                description="Default Database Connection String" />
    <!-- 196.14.77.139 -->
   
    <AllowManualStoredProcedureExecution value="false"
                                         description="allow execution of stored procedures from outside data classes (bad practice!)" />
    <SqlPath value="Data/sql"
             description="Path to the XML Query Files"/>
  </Data>
  <Users>
    <EncryptionData value="(rS06BeTdkbD9TB9RUWQWESvsJUs+kw82wcTlN2e+8NBAB87CPkT/gl3sDQnh4NbjhzQJB36h6KTNX80HeQHnNw==)"
                    description="Encryption data" />
  </Users>
  <Communication>
    <Mail>
      <SmtpServer value="127.0.0.1" description="SMTP Server Used By Newsletter Application" />
    </Mail>
    <Sms>
      <LogicSms>
        <Username value="Ronelle@UIPLAY" description="Username for LogicSms" />
        <Password value="wong2fu" description="Password for LogicSms" />
      </LogicSms>
    </Sms>
  </Communication>
  <CMS>
    <Handlers>
      <DelayedResponseHandler.Timeout value="50000"
                                      description="Timeout for DelayedResponseHandler" />
    </Handlers>
  </CMS>
  <CRM>
    <CampaignTools>
      <Newsletter>
        <FromEmail value="test@uiplay.com"
                   description="Address used as from field for newsletters" />
        <UnsubscribeLinkFormat value="http://localhost:100/index.aspx?PageKey=Unsubscribe&amp;Id=[:ContactId:]"
                               description="Url used to unsubrscribe a contact" />
      </Newsletter>
    </CampaignTools>
  </CRM>

  <PayinDueDay value="24"
               description="Day by which Pay-ins should be entered." />
</configuration>

Recommended Answers

All 2 Replies

Think about ReadXml, a method of DataSet.

i have tried using the ReadXml method already but it seems as if the dataset is splitting the apsettings.xml data into 24 tables whilst i want it in a single table with three columns.

here is the code

public static DataSet GetDataSet()
        {
            var ds = new DataSet();
           ds.ReadXml("~/data/AppSettings.xml");
           return ds;
        }

bt after debugging, the method returns ds with 24 tables

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.