日历控件中的复选框 [英] Check box in Calender control

查看:101
本文介绍了日历控件中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在我的项目中,我正在使用asp.net和C#.我有一个asp.net压光机控件,在运行时,我在dayrender块中使用以下代码在压光机的每个单元格中添加了复选框.

Hi All,

In my project i am using asp.net and C#. I am having a asp.net calender control and in run time i am adding checkbox to each of the cell of the calender using the following code in the dayrender block.

CheckBox chkSelect = new CheckBox();
e.Cell.Controls.Add(chkSelect);



还有一个按钮btnSave.单击此按钮后,我要保存选定的日期.但是我无法确定如何获取所选日期,即选中了哪个日期的复选框?

如果有人对此提供帮助,将不胜感激.



And there''s a button as btnSave. On click of this button i want to save the selected dates. But i am not able to fin out how do i get the selected dates i.e. checkbox is checked for which date?

It would be really appreciated if somebody helps me in this.

推荐答案

要使复选框存在于viewstate中,您需要在页面加载之前添加它们.完成此操作后,您可以按照将它们放入其中的方式找到它们,搜索控件的单元格,然后使用FindControl查找它们.
For the checkboxes to exist in viewstate, you need to add them before page load. Once you''ve done that, you can find them the same way you put them in there, search through the cells of the control and find them with FindControl.


但是我怎么添加他们在页面加载之前?
我的意思是我必须将复选框添加到日历控件的每个单元格中.所以我将代码放入DayRender事件中.

您能举任何例子或添加更多信息吗!!
But how can i add them before page load?
I mean i have to add the checkboxes to each of the cell in the calender control. So i put the code in DayRender event.

Can u give any example or add more information to this please!!


任何动态添加控件的教程都会为您解释一下.我相信LoadViewState方法是在页面加载之前注入代码的好地方.
Any tutorial in dynamically adding controls will explain it for you. I believe that the LoadViewState method is a good place to inject code prior to page load.


这篇关于日历控件中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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