我的ListView具有以下EditItemTemplate模板:
I have ListView that has the following EditItemTemplate:
<EditItemTemplate>
<tr style="">
<td>
<asp:LinkButton ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
<asp:LinkButton ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
</td>
<td>
<asp:TextBox ID="FundingSource1TextBox" runat="server" Text='<%# Bind("FundingSource1") %>' />
</td>
<td>
<asp:TextBox ID="CashTextBox" runat="server" Text='<%# Bind("Cash") %>' />
</td>
<td>
<asp:TextBox ID="InKindTextBox" runat="server" Text='<%# Bind("InKind") %>' />
</td>
<td>
<asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>' />
</td>
<td>
<asp:TextBox ID="ExpectedAwardDateTextBox" runat="server" Text='<%# Bind("ExpectedAwardDate","{0:MM/dd/yyyy}) %>' onclientclick="datepicker()" />
</td>
</tr>
</EditItemTemplate>
我想格式化 ExpectedAwardDateTextBox
所以它显示了一个短日期时间,但还没有找到一个办法做到这一点无需进入code后面。在项目模板,我有以下行来格式化出现在吊牌日期:
I would like to format the ExpectedAwardDateTextBox
so it shows a short date time but haven't found a way to do this without going into the code behind. In the Item template I have the following line to format the date that appears in the lable:
<asp:Label ID="ExpectedAwardDateLabel" runat="server" Text='<%# String.Format("{0:M/d/yyyy}",Eval("ExpectedAwardDate")) %>' />
和我想找到一个类似的方法做的 InsertTemplate则
。
And I would like to find a similar method to do with the insertItemTemplate
.
您可以使用绑定()
超载是这样的:
You can use the Bind()
overload like this:
<%# Bind("ExpectedAwardDate", "{0:M/d/yyyy}") %>
同样为您评估和演示过:
Same for your Eval too:
<asp:Label ID="ExpectedAwardDateLabel" runat="server"
Text='<%# Eval("ExpectedAwardDate","{0:M/d/yyyy}") %>' />