仅选择年份ASP.NET Web表单 [英] Select only year ASP.NET web form

查看:99
本文介绍了仅选择年份ASP.NET Web表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从datepicker或年份选择器中选择年份到文本框。但不能那样做。我搜索了很多。请帮帮我。



我的尝试:



I need to select only year to textbox from datepicker or year picker. But cannot do that. i searched lot. please help me.

What I have tried:

i searched lot. please help me.

推荐答案

这个想法可以简单如下 -

1.你可以得到日历中的日期值

2.然后使用属性从中提取年份。



示例:

如果您使用ASP.Net日历控件,

The idea can be as simple as following-
1. You can get a date value from the calendar
2. Then just extract the year from that using Year property.

Example:
If you are using ASP.Net calendar control,
int requiredYear = Calendar1.SelectedDate.Year;





如果这种方法对您不起作用,请分享您的尝试,以便我们会尝试建议,为什么不起作用。



谢谢。



If this approach doesn't work for you, please share what you have tried so that we will try to suggest, why that doesn't work.

Thanks.


这篇关于仅选择年份ASP.NET Web表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆