Re: custom validator controls within a datagrid
That is really helpful. Thank you very much!
David Yuan [MS] wrote:
> Since the Textbox and the Validator is created in the Template, they
> not appear as the data member of the Page class. Hence you can't add
> handler for the CustomValidator in the IDE. To add event handler for
> you need to write your own code. Below is some sample code on how to
> Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> 'If e.Item.ItemIndex <> 1 Then Exit Sub
> Dim c As CustomValidator
> c = CType(e.Item.Cells(0).FindControl("CustomValidator 2"),
> If c Is Nothing Then Exit Sub
> AddHandler c.ServerValidate, AddressOf
> End Sub
> Private Sub CustomValidator2_ServerValidate(ByVal source As
> ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs)
> Debug.WriteLine("server validate")
> End Sub
> Hope this helps.
> David Yuan [MS]
> This posting is provided "AS IS" with no warranties, and confers no
> "Got .Net? http://www.gotdotnet.com".
|All times are GMT. The time now is 02:34 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.