S
Sjaakie Helderhorst
Hi,
Somehow pushing an image-button doesn't trigger the CompareValidator,
resulting in errors when entering string characters.
Could someone please tell me what I did wrong?
Thanks in advance!
See datagrid code below:
<aspataGrid id="gridProducts" ....>
....
<ItemTemplate>
<asp:TextBox ID="amount" BorderStyle="Solid"
Width="40" Runat="server" MaxLength="5"
Text='<%# DataBinder.Eval(Container.DataItem, "amount") %>'
Font-Size="11px">
</asp:TextBox>
<asp:CompareValidator ControlToValidate="amount"
ErrorMessage="*" Operator=DataTypeCheck Type=Integer
Runat="server" Display="Dynamic">
</asp:CompareValidator>
</ItemTemplate>
<asp:ButtonColumn Text="<img src='./images/button_order.gif'
border=0>" HeaderText="OK" CommandName="Submit">
</asp:ButtonColumn>
</columns>
</aspataGrid>
Code-behind:
Private Sub gridProducts_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
gridProducts.ItemCommand
.... <updating a dataset with amount-value here>
End Sub
Somehow pushing an image-button doesn't trigger the CompareValidator,
resulting in errors when entering string characters.
Could someone please tell me what I did wrong?
Thanks in advance!
See datagrid code below:
<aspataGrid id="gridProducts" ....>
....
<ItemTemplate>
<asp:TextBox ID="amount" BorderStyle="Solid"
Width="40" Runat="server" MaxLength="5"
Text='<%# DataBinder.Eval(Container.DataItem, "amount") %>'
Font-Size="11px">
</asp:TextBox>
<asp:CompareValidator ControlToValidate="amount"
ErrorMessage="*" Operator=DataTypeCheck Type=Integer
Runat="server" Display="Dynamic">
</asp:CompareValidator>
</ItemTemplate>
<asp:ButtonColumn Text="<img src='./images/button_order.gif'
border=0>" HeaderText="OK" CommandName="Submit">
</asp:ButtonColumn>
</columns>
</aspataGrid>
Code-behind:
Private Sub gridProducts_ItemCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
gridProducts.ItemCommand
.... <updating a dataset with amount-value here>
End Sub