c# - How to disable the dropdownlist in DetailView depending on the date? -
i'm using dropdownlist in detailview (editmode) , disable depending on date of system. illustration : between 18 june , 20 june, create dropdownlist disabled (gray).
any thought ?
please seek ,
protected void page_load(object sender, eventargs e) { this.disabletime(new datetime(2014,5,1),new datetime(2014,10,1)); } private void disabletime(datetime starttime, datetime endtime) { var currenttime = datetime.now; if (currenttime > starttime && currenttime < endtime) { this.dropdownlist1.enabled = false; } } if utilize detailsview , edittemplate , seek in detailsview_prerender or detailsview_itemcreated event find dropdownlist command below
protected void detailsview1_itemcreated(object sender, eventargs e) { dropdownlist ddl = detailsview1.findcontrol("your dropdownlist id") dropdownlist; ddl.enabled = false; } c# asp.net
No comments:
Post a Comment