ASP.Net Textbox problem ?

  • Thread starter Thread starter Luqman
  • Start date Start date
L

Luqman

I have coded in Textbox_changed Event:

If CType(txtVoucherNo.Text, Long) = 0 Then

Me.DetailsView1.ChangeMode(DetailsViewMode.Insert)

Me.DetailsView1.AutoGenerateInsertButton = True

Me.DetailsView1.AutoGenerateEditButton = True

Exit Sub

End If



When page is loaded 1st time, and I type 0 (Zero) in Textbox and press
Enter, DetailView changes its mode to Insert Mode, which I require, however
if I press Cancel on DetailView without entering anything and then click on
textbox and press Enter again after typing 0 (Zero), nothing happens, any
idea please ?

It seems that DetailView Cancel Button has added some extra character in the
Textbox which is not visible to me.

Best Regards,

Luqman
 
Why not set a breakpoint on the TextChanged event and see if the event is
even being fired? If the value of the textbox where being changed, you could
find out at the breakpoint also.
 
yes, the event was firing but 2nd time it did not find the value "0" in
textbox, it was "0" + Enter, so on ModeChanging Event of DetailView Control,
I set the textbox.text="" and it worked out.

Best Regards,

Luqman
 
Back
Top