Reputation: 1411
I am trying to set the row limit for my gridview webpart on sharepoint site in the appsettings of the web.config file.
<appSettings>
<add key ="RowLimit" value="6"/>
<add key="FeedCacheTime" value="300" />
<add key="FeedPageUrl" value="/_layouts/feed.aspx?" />
<add key="FeedXsl1" value="/Style Library/Xsl Style Sheets/Rss.xsl" />
<add key="ReportViewerMessages" value="Microsoft.SharePoint.Portal.Analytics.UI.ReportViewerMessages, Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
and then in my code file i am using the below statement
string x = ConfigurationSettings.AppSettings["RowLimit"];
this line is giving an error stating ConfigurationSettings.AppSettings "This method is obsolete",
What is that i am doing wrong? Please let me know.
Upvotes: 0
Views: 2437
Reputation: 37516
The replacement is System.Configuration.ConfigurationManager.AppSettings
.
Example:
using System.Configuration;
...
string x = ConfigurationManager.AppSettings["RowLimit"];
Upvotes: 0
Reputation: 16719
You should be using the ConfigurationManager class instead. ConfigurationSettings
was deprecated in .NET 2.0. Use it the same way as you would use ConfigurationSettings
, but be aware that you will have to add a reference to System.Configuration, if you don't have it already.
Upvotes: 3