尝试在ASP.NET C#上使用JavaScript DateTimePick [英] Trying to use JavaScript DateTimePick on ASP.NET C#

查看:59
本文介绍了尝试在ASP.NET C#上使用JavaScript DateTimePick的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ASP.NET,Visual Studio 2010上使用javaScript datepicker.
我无法将其与服务器组件关联.

Im trying to use javaScript datepicker on ASP.NET, Visual Studio 2010.
I cant associate it on a Server Component.

<script type="text/javascript">
        $(function () {
            $(''#BTTDataFIM'').datepicker({
                dateFormat: ''dd/mm/yy'',
                changeMonth: true,
                dayNamesMin: [''Sg'', ''Tr'', ''Qa'', ''Qi'', ''Sx'', ''Sb'', ''Dm''],
                dayNamesShort: [''Seg'', ''Ter'', ''Qua'', ''Qui'', ''Sex'', ''Sab'', ''Dom''],
                defaultDate: null,
                nextText: ''Próximo'',
                prevText: ''Anterior'',
                showAnim: ''fold'',
                showOn: ''button'',
                buttonText: ''...''
            });
        });
        }
    </script>

    <input type= "text" id="BTTDataFIM" class="CampoData" value="" />


它可以正常工作,但是我需要一个服务器控件(INPUT)组件才能通过C#代码读取所选的日期.
如果我将INPUT组件更改为runat ="Server"对象,则datepick组件将停止工作.

有人可以帮我吗?

谢谢.

Guilherme


It works properly, but I need a Server Control (INPUT) Component, to read the selected Date by the C# code.
If I Change my INPUT component to a runat="Server" object, the datepick component stops to work.

Can anybody help me ?

Thanks.

Guilherme

推荐答案

(function(){
(function () {


(``#BTTDataFIM'').datepicker({ dateFormat:"dd/mm/yy", changeMonth:是的, dayNamesMin:["Sg","Tr","Qa","Qi","Sx","Sb","Dm"], dayNamesShort:["Seg","Ter","Qua","Qui","Sex","Sab","Dom"], defaultDate:null, nextText:``Próximo'', prevText:``前'', showAnim:``折叠'', showOn:``按钮'', buttonText:``...'' }); }); } </script> < input type ="text" id ="BTTDataFIM" class ="CampoData" value ="/>
(''#BTTDataFIM'').datepicker({ dateFormat: ''dd/mm/yy'', changeMonth: true, dayNamesMin: [''Sg'', ''Tr'', ''Qa'', ''Qi'', ''Sx'', ''Sb'', ''Dm''], dayNamesShort: [''Seg'', ''Ter'', ''Qua'', ''Qui'', ''Sex'', ''Sab'', ''Dom''], defaultDate: null, nextText: ''Próximo'', prevText: ''Anterior'', showAnim: ''fold'', showOn: ''button'', buttonText: ''...'' }); }); } </script> <input type= "text" id="BTTDataFIM" class="CampoData" value="" />


它可以正常工作,但是我需要一个服务器控件(INPUT)组件才能通过C#代码读取所选的日期.
如果我将INPUT组件更改为runat ="Server"对象,则datepick组件将停止工作.

有人可以帮我吗?

谢谢.

Guilherme


It works properly, but I need a Server Control (INPUT) Component, to read the selected Date by the C# code.
If I Change my INPUT component to a runat="Server" object, the datepick component stops to work.

Can anybody help me ?

Thanks.

Guilherme


最有可能是ASP.NET在呈现元素时应用名称修改的问题. id ="BTTDataFIM"将更改为id ="ctr001_BTTDataFIM".

您可以使用
解决此问题
It is most likely an issue with the name mangling applied by ASP.NET when elements are rendered. id="BTTDataFIM" will be changed to something like id="ctr001_BTTDataFIM".

You can work around this by using


这篇关于尝试在ASP.NET C#上使用JavaScript DateTimePick的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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