ListView InsertItemTemplate Does not work
I can't get <%# Eval("ID") %> work, although it works outside of the InserItemTemplate. What is worng?
<InsertItemTemplate>
<tr style="">
<td>
<asp:Button ID="btnInsert" runat="server" CommandName="InsertPhone" CommandArgument='<%# Eval("ID") %>' Text="InsertPhone" />
</td>
<td style="width:50px">
<asp:DropDownList runat="server" ID="ddlPhoneType" DataSourceID='ObjectDataSourcePhoneTypes'
DataTextField="Name_ar" DataValueField="ID" />
</td>
<td style="width:100px">
<asp:TextBox ID="PhoneNumberLabel" runat="server" Text='' />
</td>
</tr>
</I开发者_JAVA百科nsertItemTemplate>
Thanks
Insert template isn't data bound so you can't use Eval there... Eval works in the context of a data bound row, but insert row is not data bound, so there's no data source for it. Programmably set the value in the field if you need to establish some value for a control.
精彩评论