2016-09-19 81 views
0

我需要幫助,我想使用BootStrap元素timepicker與ASP.NET C#頁面,我添加主頁面中的所有引用,它的工作時,我使用HTML代碼,但現在我想要使用作爲ASP.net如何使用Timepicker與Asp:Textbox?下面 查找代碼使用ASP.NET頁面的BootStrap元素時間選擇器頁面

HTML代碼

<div class="row"> 
<div class="col-xs-8 col-sm-11"> 

<label for="timepicker1">Enter:</label> 

<div class="input-group bootstrap-timepicker"> 
<input id="timepicker1" type="text" class="form-control" /> 
<span class="input-group-addon"> 
<i class="fa fa-clock-o bigger-110"></i> 
</span> 
</div> 
</div> 
</div> 

回答

0

使用了ASP.NET的TextBox以下:

<div class="input-group bootstrap-timepicker timepicker"> 
    <asp:TextBox ID="txtTime" data-provide="timepicker" CssClass="form-control timepicker" runat="server"></asp:TextBox> 
<span class="input-group-addon"><i class="glyphicon glyphicon-time"></i></span> 

然後在腳本中,請執行下列操作:

<script> 
$(function() { 
    $("#txtTime").timepicker({ 
     showInputs: false //Set showInputs to false 
    }); 
}) 
</script> 

sample_timepicker

請點擊這裏下載文件:https://github.com/jdewit/bootstrap-timepicker/releases

0

的祕密就得到控制工作是:數據提供=「timepicker」。當您設置runat =「server」時,這是必需的。

例:

<script> 
    $(function() { 
     $(".timepicker").timepicker({ 
     minuteStep: 15 
     }); 
    }) 
</script> 

<asp:TextBox ID="StartTime" data-provide="timepicker" CssClass="timepicker" runat="server" />