I have added an onblur attribute to a textbox, what should put as the EventName for my UpdatePanel? I tried onblur but it gave me an error:
‘Could not find an event named ‘onblur’ on associated control ‘uitxtCamCode’ for the trigger in UpdatePanel ‘UpdatePanel2′.’
Please kindly advice. Thanks.
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="uitxtCamCode" EventName="onblur" />
</Triggers>
<ContentTemplate>
<asp:Label runat="server" ID="uilblCamCode" Text="<%$ Resources:loyaltyManagerResources, uilblCamCode %>"
CssClass="label">
</asp:Label>
<asp:TextBox ID="uitxtCamCode" runat="server" CssClass="tooltip" Width="150px"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim onBlurScript = Page.ClientScript.GetPostBackEventReference(uitxtCamCode, "OnBlur")
uitxtCamCode.Attributes.Add("onblur", onBlurScript)
End Sub
Private Sub HandleCustomPostbackEvent(ByVal ctrlName As String, ByVal args As String)
CheckAvailability()
If lblCCodeAvailability.ForeColor = Drawing.Color.Red And uitxtCamCode.Text <> "" Then
If (ctrlName = uitxtCamCode.UniqueID And args = "OnBlur") Then
End If
Else
Exit Sub
End If
End Sub
That’s a Javascript event handler.
It cannot have anything to do with an
UpdatePanel.