Repeater child control not Firing TextChanged

mkolias

Member
Joined
Feb 5, 2007
Messages
9
Programming Experience
5-10
I have been struggling with this for days. I have a repeater that contains several textbox controls. When the text for that control changes I need it to fire a text changed event so that I can update the datasource. Here is my code. Any help would be greatly appreciated.

This is my asp code that creates the repeater and defines the items
<asp:repeater id="rptrContractDetails" Runat="server">
<ItemTemplate>
<tr>
<td style="BORDER-BOTTOM: #bbbbbb 1px solid">
<asp:linkbutton ID="DeleteButton" Runat="server" CommandName="DeleteContractLine" Text="Delete"></asp:linkbutton>
</td>
<td style="BORDER-BOTTOM: #bbbbbb 1px solid" align="left">
<asp:label id="lblSeq" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Seq") %>'></asp:label></td>
<td style="BORDER-BOTTOM: #bbbbbb 1px solid" align="left">
<asp:textbox id="txtProduct" Runat="server" AutoPostBack = true CssClass="textbox" Text='<%# DataBinder.Eval(Container.DataItem, "Product.ProductCode") %>'></asp:textbox>
<asp:button id="btnLookupProduct" runat="server" CssClass="submit" Text="..."></asp:button><input id="txtContractDetailId" type="hidden" name="txtContractDetailId" runat="server">
</td>
<td style="BORDER-BOTTOM: #bbbbbb 1px solid" align="left">
<asp:textbox id="txtProductColor" Runat="server" AutoPostBack = true CssClass="textbox" Text='<%# DataBinder.Eval(Container.DataItem, "ProductColor.Color") %>'></asp:textbox><asp:button id="btnLookupProductColor" runat="server" CssClass="submit" Text="..."></asp:button></td>
<td style="BORDER-BOTTOM: #bbbbbb 1px solid" align="left">
<asp:textbox id="txtInvoicePrice" Runat="server" AutoPostBack = true CssClass="textbox" Text='<%# DataBinder.Eval(Container.DataItem, "InvoicePrice") %>'></asp:textbox></td>
<td style="BORDER-BOTTOM: #bbbbbb 1px solid" align="left">
<asp:textbox id="txtDetailTax" Runat="server" CssClass="textbox" AutoPostBack = true Text='<%# DataBinder.Eval(Container.DataItem, "Tax") %>'></asp:textbox></td>
</ItemTemplate>
</asp:repeater>

VB.net code that creates the repeater items after binding datasource

Private Sub rptrContractDetails_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptrContractDetails.ItemCreated

If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
If Not e.Item.DataItem Is Nothing Then


Dim itm As ContractDetail = DataSource(CType(e.Item.DataItem, ContractDetail).ContractDetailId)

Dim txtProduct As TextBox = CType(e.Item.FindControl("txtProduct"), TextBox)
Dim btnLookupProduct As Button = CType(e.Item.FindControl("btnLookupProduct"), Button)
Dim txtProductColor As TextBox = CType(e.Item.FindControl("txtProductColor"), TextBox)
Dim btnLookupProductColor As Button = CType(e.Item.FindControl("btnLookupProductColor"), Button)
Dim txtInvoicePrice As TextBox = CType(e.Item.FindControl("txtInvoicePrice"), TextBox)
Dim txtDetailTax As TextBox = CType(e.Item.FindControl("txtDetailTax"), TextBox)


If Not itm Is Nothing Then

Assigns the textchanged event to the repeater items

AddHandler txtProduct.TextChanged, AddressOf txtProduct_TextChanged
AddHandler txtProductColor.TextChanged, AddressOf txtProductColor_TextChanged
AddHandler txtInvoicePrice.TextChanged, AddressOf txtInvoicePrice_TextChanged
AddHandler txtDetailTax.TextChanged, AddressOf txtDetailTax_TextChanged

Try


Catch ex As Exception
Response.Write(ex.Message)
End Try
End If
End If
End If
End Sub

Ex. of text changed event that should be getting hit
Private Sub txtProduct_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
MsgBox("Yeah")
End Sub
 
Back
Top