Ivoking comparevalidator

  • Thread starter Thread starter Sjaakie Helderhorst
  • Start date Start date
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:

<asp:DataGrid 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="&lt;img src='./images/button_order.gif'
border=0&gt;" HeaderText="OK" CommandName="Submit">
</asp:ButtonColumn>
</columns>
</asp:DataGrid>

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
 
Hi

I'm having the same problem, except that I can get it to work properly on one server but not on another under a different domain name. I've switched code back and forth and it consistanly works on one and not on the other

Did you ever resolve this

Brian Runmar

----- Sjaakie Helderhorst wrote: ----

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

<asp:DataGrid 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=Intege
Runat="server" Display="Dynamic"></asp:CompareValidator></ItemTemplate><asp:ButtonColumn Text="&lt;img src='./images/button_order.gif
border=0&gt;" HeaderText="OK" CommandName="Submit"></asp:ButtonColumn></columns></asp:DataGrid

Code-behind

Private Sub gridProducts_ItemCommand(ByVal source As Object, ByVal e A
System.Web.UI.WebControls.DataGridCommandEventArgs) Handle
gridProducts.ItemComman
.... <updating a dataset with amount-value here
End Su
 
Back
Top