Toolstripbutton not validating textbox.
I have a textbox, a standard button and a toolstrip containing a couple of buttons. In the validating event of the textbox i coded to check whether it is blank. If yes then it shows a message 'Enter Value'. When the standard button is clicked while the textbox is empty, it's validating properly and showing the message but when the toolstripbutton is clicked it's not not validating the textbox and no message is being shown. It seems that I gotto write the validation code explicitly in the toolstripbutton_click event which is too troublesome when there are multiple textboxes and toolstripbuttons on a single form. What I want to know is whether the textbox_validating can be fired while the toolstripbutton is clicked?
Handling toolstrips is really a headache.
Please help. I'm badly in need of it. Regards.
The ToolStrip is not a Control, it is a Component (it appears in the component tray at the bottom of the form). Components do not trigger validation (they do not have the CauseValidation property that controls have).
An event being a Sub as any other, you can call it. The solution is thus to call the validation event procedure from the Click of your ToolStripButton.
Private Sub ToolStripButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
Or else u can write either of the two in toolstripbutton click event:
By jd31068 in forum ASP.NET
Last Post: 09-25-2009, 08:19 AM
By zhixuen in forum ASP.NET
Last Post: 02-10-2009, 05:09 AM
By saquib189 in forum ASP.NET
Last Post: 09-19-2008, 02:57 PM
Last Post: 07-07-2006, 06:37 AM
By saibaba111 in forum ASP.NET
Last Post: 05-08-2006, 09:28 PM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center