Click here to Skip to main content
15,311,717 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Here My requirement is how to control page count in webgrid through the web.congig.

for example if i enter pagecount values as 5 its giving me 5 records(rows), if i pass the 10 records it is giving me 10 records to display on grid.

but i would like to do the same operation from web.config file. if i pass the same values in web.config the changes should take affect from web.config.

can anyone help me to do that?

public ActionResult BusinessSearch(string searchType, int? searchIdvalue, string searchValue, int pidx = 1)
    var criteria = (pidx != 1 && TempData["SearchCriteria"] != null) ? (Criteria)TempData["SearchCriteria"] : new Criteria()
        //Type = searchType,
        Type = "Name",
        ID = searchValue,
        PageCount = 5

1 solution

      <add key="PageItems" value="10" />

string pageItems = WebConfigurationManager.AppSettings["PageItems"]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900