Setting Date format in dropdown list

后端 未结 5 1101
孤城傲影
孤城傲影 2021-01-19 11:50

I am retrieving date values from dataset(_dsst) and populating them in dropdown list(drpStartYear).

Since I am storing date as datetime datatype, I am

5条回答
  •  北恋
    北恋 (楼主)
    2021-01-19 12:12

    You have to set DataTextField as well -

      drpStartYear.DataValueField = "StartDate";
    
      drpStartYear.DataTextField = "StartDate";
      drpStartYear.DataTextFormatString = "{0:dd-MM-yyyy}";
      drpStartYear.DataBind();
    

提交回复
热议问题