Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

NumericUpDownExtender and js

$
0
0

I am using the NumericUpDownExtender for the first time in an asp.net page.  I have a TextBox that is inside a GridView and I want to do a calculation in javascript whenever the value is changed by user typing OR using the extender.  I am adding the attribute in the RowDatabound event of the GridView as shown below.  Also, I have included the event code I have created.  The problem I am having is that the "onchange" event is running for each row on the GridView during databound, I think. How can I make this work without having the onchange event fire except when the TextBox is changed or the NumericUpDownExtender is clicked?  Thanks.

<asp:TemplateField HeaderText="Grams"><ItemTemplate><asp:TextBox ID="txtActGrams" runat="server" Text='<%# Bind("ActGrams") %>' CssClass="txtright" Width="40"></asp:TextBox><asp:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" TargetControlID="txtActGrams" Width="60" Minimum="0"></asp:NumericUpDownExtender><asp:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="txtActGrams" ValidChars="0123456789."></asp:FilteredTextBoxExtender></ItemTemplate><FooterTemplate><asp:Label ID="LblActual" runat="server" Text="Actual" BackColor="White"></asp:Label><br /><asp:Label ID="LblGoal" runat="server" Text="GOAL" Font-Bold="True"></asp:Label></FooterTemplate></asp:TemplateField>

    Protected Sub gvActualFoods_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs)
        If e.Row.RowType = DataControlRowType.DataRow Then
            If e.Row.RowState = DataControlRowState.Normal Or e.Row.RowState = DataControlRowState.Alternate Then
                Dim tx As TextBox = e.Row.FindControl("txtActGrams")
                tx.Attributes.Add("onchange", "confirmDel('test');")
	    End If
	End If
    End Sub


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>