Ekrem Tapan

Ekrem Tapan

  • NA
  • 967
  • 81.2k

conditions statment on htmltable

Dec 15 2015 12:39 AM
hi everyone ,
 
i want to ask  a, first i have a listbox then left and right side have a two button 
 
when i search two dates for ex from 2010 to 2015 , these years inserting  listbox  2010,2011,2012,2013,2014,2015, 
 
then when i use button  line 27 and 29 if im back to 2010 then again click button i have a get blank page, so how can i conditions this statment ? 
 
thanks  
 
1- htmlTr = new TableRow();
2-htmlTable.Rows.Add(htmlTr);
3-
4-var lstYearList = new ListBox();
5-lstYearList.Attributes.Add("style", "Overflow:hidden");
6-lstYearList.Height = 20;
7-lstYearList.CssClass = "dev-year-list";
8-int minYear = ConvertLib.ToInt(searchConds.Year2, 2007);
9-int maxYear = ConvertLib.ToInt(searchConds.Year, DateTime.Today.Year);
10-var loopYear = minYear;
11-for (; loopYear <= maxYear; loopYear++)
12-{
13-lstYearList.Items.Add(new ListItem(loopYear.ToString(), loopYear.ToString()));
14-}
15-
16-if (specYear.HasValue)
17-{
18-WebUtilBox.SetListControlSelected(specYear.Value.ToString(), lstYearList);
19-}
20-else
21-{
22-WebUtilBox.SetListControlSelected(maxYear.ToString(), lstYearList);
23-}
24-
25-htmlTh = new TableHeaderCell();
26-htmlTh.CssClass = "year";
27-htmlTh.Text += string.Format("<a href='javascript:;' class='prev dev-prev-year' onclick='prevYear();'></a>");
28-htmlTh.Text += WebUtilBox.ToHtmlText(lstYearList);
29-htmlTh.Text += string.Format("<a href='javascript:;' class='next dev-next-year' onclick='nextYear();'></a>");
30-htmlTr.Cells.Add(htmlTh);