如何在离开列表视图内的文本框时创建事件触发器

时间:2014-11-17 20:59:56

标签: asp.net vb.net

我有一个包含两个文本框和一个标签的列表视图。我想为一个文本框创建一个事件触发器。因此,当用户离开文本框时,它会更改同一行上的标签。我一直在寻找答案,但我找不到。任何帮助将不胜感激

.ASPX

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ListView ID="ListView1" runat="server" DataSourceID="XmlDataSource2">
<LayoutTemplate>
<table cellpadding="2" width="640px" border="1" runat="server" id="tblProducts">
        <tr id="Tr1" runat="server">
          <th id="Th1" runat="server">EmployeeID</th>
          <th id="Th2" runat="server">Name</th>
          <th id="Th3" runat="server">Absentee Code</th>
        </tr>
        <tr runat="server" id="itemPlaceholder" />
</table>    
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td>
    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
<td>
    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>    
</ItemTemplate>        
</asp:ListView>
<asp:XmlDataSource ID="XmlDataSource2" runat="server" 
    DataFile="~/App_Data/EmptyRows.xml"></asp:XmlDataSource>
<div style="height: 36px">
    <asp:Button ID="Button1" runat="server" Text="Submitt" />
</div>

.VB这是我正在尝试的但它不起作用

    Protected Sub ListView1_ItemCommand(sender As Object, e As ListViewCommandEventArgs)
    Dim textbox1 As TextBox = e.Item.FindControl("TextBox1")


End Sub

0 个答案:

没有答案