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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Field value from grid

Status
Not open for further replies.

quakeunity77

IS-IT--Management
Jun 3, 2010
36
US
I have a grid with an access database. I need to get the value of a date field in the grid in order to calculate another date. How do I recover the value of the date field?
 
grid's are just visual controls at this point they are just formatted text, so getting the value from here is not a good approach.

I'm assuming the data for the grid comes from the access database. in that case, get the date from the row/entity in the data source and calculate the date based on that value. then bind to the grid.

another option: calculate the date in the query.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Thank you for your reply. I do not need to enter the date into the grid. I just need to get the info from that field to calculate another date (a month later or more) that will be displayed in a label. I have a button on the form. What coding should I use in the button to extract the date field info, calculate 28 days later and display in label?

 
Loop through the datasource until you find the row you want. Grab the column value you need. Then use the DateTime.DateAdd() method to calculate your date.
 
What code should I use to loop thru the grid? I used to work with Foxpro and asp seems very different
 
In that case, take some time to learn the basics of OOP. the syntax varies from language to language, but the concepts are the same. Once you are comfortable with the basics introduce webforms and asp.net.

MSDN is a great resource for the API documentation. I wouldn't trust their code examples, but it's a place to start.

understanding the environments (.net, http), the frameworks (asp.net, webforms, ado.net) and the languages (VB/C#, css, javascript) will help you make informed decisions about how to design your application.


Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top