Click here to Skip to main content
13,086,019 members (84,342 online)
Rate this:
Please Sign up or sign in to vote.
See more:

i want to hide the date based on the database record.That is if the date is having record means i want to display date in dropdown list otherwise the date is to be hide in the dropdownlist..
how can i done this..

string[] date = new string[8];
DateTime dt = DateTime.UtcNow.AddHours(5.5);
DropDownList1.Items.Insert(0,"--SELECT DATE--");
DropDownList1.Items.Insert(1, new ListItem(dt.ToString("MM/dd/yyyy")));
for (int i = 1; i < 3; i++)
string s = dt.AddDays(-i).ToString("MM/dd/yyyy");
DropDownList1.Items.Insert(1+i, new ListItem(s, s));
this is my code to load date.i have call this in pageload().Three dates i nedd to display in dropdownlist.
if the date is not having values means i need to display date in dropdown..otherwise no need to display..
Can any one help me?
Posted 4-Dec-11 19:09pm
Updated 4-Dec-11 19:31pm
koolprasad2003 5-Dec-11 1:14am
confused ! Please explain it.
Karthik Harve 5-Dec-11 1:22am
from where are you fetching the dates,,?? from database..?? any min and max dates..?? explain more..!!!!!!

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

So what problem you are facing. If you have put all the items in aspx then you can remove the items(dates) from the dropdownlist on Load event.

Or better you get all possible dates from database and bind the dropdown dynamically.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 5 Dec 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100