How to use the Web.Config entry into GridView control in asp

Jun 10, 2010 Posted by Lara Kannan
How to use the Web.Config entry into GridView control in asp.net?

Put your data into the appSettings section of your web.config:

For en example, if you need the PageSize value for gridview then

<appSettings>
<add key="MyPageSize" value="25"/>
</appSettings>

Use this web.config value into gridview by using below method.

<asp:GridView
ID="GridView"
runat="Server"
PageSize="<%$ AppSettings:MyPageSize % >"
>
</asp:GridView>

Hope this will help you.
Share
Labels: ,

Post a Comment