Jun 10, 2010

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

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.

No comments:

Post a Comment