Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting datagrid maximum row values in web config.

Status
Not open for further replies.

LauraCairns

Programmer
Jul 26, 2004
173
0
0
GB
Does anyone know code which I can use to set the value of rows for a datagrid in my project. Basically I need to check that a datagrid doesn't have more than a certain number of rows before I allow a user to add a row. I've been asked to set the allowed number of rows in the web config file. Does anyone know were abouts I put this in the web-config file and what code I write.
Thanks for any help anyone can give me.
 
Here is one way,
in the web.config

<appSettings>
<add key="gridRows" value="10" />
</appSettings>

Then in your codebehind

Int32 iGridRows;
iGridRows = Convert.ToInt32(ConfigurationSettings.AppSettings["gridRows"]);

Just and aside, it's nice to encapsulate this in a class.

Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top