如何在视图状态中保存所选日期 [英] how to save selected date in view state

查看:60
本文介绍了如何在视图状态中保存所选日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个下拉列表。在那个下拉列表中有日期。



Bathdate 2015年6月21日



coursedate 2015年6月22日


i想要在viewstate中保存Selected Batchdate。 (2015年6月21日)



比较查看日期与coursedate(2015年6月22日)





如果两个日期都不连续,我想按以下方式显示消息。



两个日期必须连续。



我怎么能在asp.net中使用csharp。

解决方案

你可以按照Arkadeep给出的解决方案。



Viewstate用于页面。如果您要导航到其他屏幕,那么您可以使用查询字符串或会话。


您可以在viewstate中将您的下拉列表选定值保存为:



 ViewState [  selectdate] = dropdownlist1.SelectedValue; 





点击此链接可以更多了解ViewState。

[ Beginner-s-Guide-To-View-State


i have one dropdownlist. in that dropdownlist Dates are there.

Bathdate 21 jun 2015

coursedate 22 jun 2015

i want to save Selected Batchdate in viewstate. (21 jun 2015)

And compare viewstate date with coursedate (22 jun 2015)


if both date are not continous i want to show the message as follows.

Both date must be continous.

for that how can i do in asp.net using csharp.

解决方案

U can follow the solution given by Arkadeep.

Viewstate is for a page. If at all your going to navigate to other screen then you can use query string or Session.


you can save your dropdownlist selected value in viewstate as :

ViewState["selectdate"] = dropdownlist1.SelectedValue;



Follow this link to have more idea about ViewState.
[Beginner-s-Guide-To-View-State]


这篇关于如何在视图状态中保存所选日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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