Basically I want to either hide of show the content of different database fields based on if todays date is between a sart date field value and an end date field value.
In the olden days of asp-vb I would open the recordset, loop thru it using an if statement. - Following is logic, not code
if todays date < date_end and todays date > date_start then
response.write(rs("field_a"))
else
response.write(rs("field_b"))
end if
I am using a Master Page and code in an associated .vb page.
Does anyone have any idea on how to do the same thing in a .net DataList contol as I am getting nowhere and almost lost my hair as a consequence?
Many many thanks for your time.
Frustrated .net newbee
Loading

Sam HobbsRank #107 · 20.5K reputationPosted Jan 29, 2010, 3:10 PM EST
I am a beginner of ASP also, but it seems to me that you can use the Eval function. It might be the ASP way of doing what you need to do.
John Barwell3 reputationPosted Jan 31, 2010, 4:31 AM EST
The indicated method was how I would have gone about it under ASP.
I am looking for HOW to go about it under DOT NET
I have Tried using the if statemant to bind fileds dynamically, combined with eval, but got no where.
Please can anyone point me to a .net 3.5 VB example?
paul daniel189 reputationPosted Feb 1, 2010, 8:33 PM EST
a function that evaluates if the datalist is in edit mode, if it is I return
false and hide the items. it works great!