将引导程序日期时间选择器添加到C#中中继器内的TextBox中
Add bootstrap datetimepicker to TextBox inside a repeater in C#
这是我的中继器代码
<asp:Repeater ID="RepeaterTrackingInformation" runat="server" OnItemDataBound="RepeaterTrackingInformation_ItemDataBound">
<HeaderTemplate>
<table class="table table-condensed table-responsive">
<tr>
<th>Department</th>
<th>SentTo Date</th>
<th>Approved Date</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="LabelDepartmentName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Department") %>'></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBoxSentTo" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "SentTo") %>'></asp:TextBox>
</td>
<td>
<asp:TextBox ID="TextBoxApproved" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ReceivedFrom") %>'></asp:TextBox>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
一切都很好。我需要在每个TextBox中添加一个引导日期时间选择器,我可以用下面的例子来完成,比如这个
$('#datetimepickerStartDate').datetimepicker({
pickTime: false
});
这是我的玉米饼。如何使用jQuery或JavaScript在中继器内附加.datetimepicker。我无法访问TextBoxSetTo,因为.NET生成不同的动态ID。
我试过这个
var rep = $('<%=RepeaterTrackingInformation.ClientID%>');
在中继器中添加CssClass:
<asp:Repeater ID="RepeaterTrackingInformation" runat="server" OnItemDataBound="RepeaterTrackingInformation_ItemDataBound">
<HeaderTemplate>
<table class="table table-condensed table-responsive">
<tr>
<th>Department</th>
<th>SentTo Date</th>
<th>Approved Date</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:Label ID="LabelDepartmentName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Department") %>'></asp:Label>
</td>
<td>
<asp:TextBox ID="TextBoxSentTo" CssClass="datepicker" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "SentTo") %>'></asp:TextBox>
</td>
<td>
<asp:TextBox ID="TextBoxApproved" CssClass="datepicker" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ReceivedFrom") %>'></asp:TextBox>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
然后在javascript:中
$('.datepicker').datetimepicker({
pickTime: false
});
相关文章:
- 获取中继器控件ASP.Net中显示的单击项目文本框
- 需要在量角器中找到使用ng中继器的li元素的数量
- 如何在中继器中找到标头控制
- 让ASP.NET中继器设置一个动态名称
- 如何在使用Protractor测试时找到ng中继器的最后一个元素
- 如何在AnglujarJS ng中继器中选择特定元素
- 具有多个值的AngularJS滤波器中继器
- 量角器-如何从中继器而不是元素中获得实际值
- 中继器控件内的 IF 条件
- ng中继器打印结果0;当我运行函数时
- 如何在ng中继器运行中执行功能
- 修改asp.net中继器中的嵌入超链接
- 使用 jquery 动画幻灯片使用角度中继器切换
- .toggle() 适用于 ACF 中继器中的所有内容
- 带有中继器的 AngularJS 指令
- angularJS中继器按键错误
- AngularJS-如何在ng中继器中调用以项值为参数的控制器函数
- AngularJS-你能在一个javascript块中引用一个中继器变量吗
- 如何在javascript中获取放置在中继器内的特定标签的文本
- 将引导程序日期时间选择器添加到C#中中继器内的TextBox中