Results 1 to 4 of 4

Thread: string from webconfig

  1. #1

    Thread Starter
    Fanatic Member staticbob's Avatar
    Join Date
    Jan 2005
    Location
    Manchestershire, UK Cabbage: I do
    Posts
    619

    string from webconfig

    Guys,

    Can I change this...

    <asp:XmlDataSource ID="xmlDataSourceSections" runat="server" DataFile="~/Physical.xml" XPath="/PPRObject/Section" />

    To take a path from my webconfig for the datafile?

    AppSetting("PhysicalTemplate")

    Thanks
    Bob
    "I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: string from webconfig

    In the codebehind, you can do this:

    Code:
    xmlDataSourceSections.DataFile = System.Configuration.ConfigurationSettings.AppSettings("PhysicalTemplate").ToString()

    (Not sure if the .tostring is required)

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: string from webconfig

    Quote Originally Posted by mendhak
    In the codebehind, you can do this:

    (Not sure if the .tostring is required)
    Not required.
    ConfigurationSettings.AppSettings
    This method returns string only
    Please mark you thread resolved using the Thread Tools as shown

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: string from webconfig

    Ah, good to know. I sometimes end up using ToString() because I cannot be bothered to move my mouse over AppSettings to look at its property type and yet I can be bothered to sit here and type about it in a long winded sentence on a forum.

    Priorities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width