Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Re: custom validator controls within a datagrid (http://www.velocityreviews.com/forums/t93431-re-custom-validator-controls-within-a-datagrid.html)

zlusca@gmail.com 12-28-2004 07:13 PM

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

will
> not appear as the data member of the Page class. Hence you can't add

event
> handler for the CustomValidator in the IDE. To add event handler for

it,
> you need to write your own code. Below is some sample code on how to

do it.
>
> Private Sub DataGrid1_ItemCreated(ByVal sender As Object, ByVal e

As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles
> DataGrid1.ItemCreated
> 'If e.Item.ItemIndex <> 1 Then Exit Sub
>
> Dim c As CustomValidator
> c = CType(e.Item.Cells(0).FindControl("CustomValidator 2"),
> CustomValidator)
>
> If c Is Nothing Then Exit Sub
>
> AddHandler c.ServerValidate, AddressOf
> CustomValidator2_ServerValidate
> End Sub
>
> Private Sub CustomValidator2_ServerValidate(ByVal source As

Object,
> 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

rights.
> "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.