Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > I need CausesValidation on Paging

Reply
Thread Tools

I need CausesValidation on Paging

 
 
Mehdi
Guest
Posts: n/a
 
      05-22-2004
Hi,

Does anyone know how to set Causesvalidation =true; when paging. I need to
call my custom validator.

Thanks for the help in advance.

Regards


Mehdi


 
Reply With Quote
 
 
 
 
Rick Spiewak
Guest
Posts: n/a
 
      05-24-2004
There is a little bit of guesswork involved in this <g>:

Here are the attributes I found in the rendered HTML of a button which
causes validation.
onclick="if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript"

Based on the above, I would try putting the following in the ItemCreated
event for the datagrid:

Dim dg As DataGrid = DirectCast(sender, DataGrid)
Dim itm as DataGridItem = e.Item
If itm.ItemType <> ListItemType.Pager Then Exit Sub
' This code will only work for numeric pager style, not NextPrev
If dg.PagerStyle.Mode <> PagerMode.NumericPages Then Exit Sub
Dim dglb As LinkButton
If dg.DataSource Is Nothing Then Exit Sub
For i As Integer = 0 To itm.Cells(0).Controls.Count - 1
Dim c As Control = itm.Cells(0).Controls(i)
If c.GetType.ToString =
"System.Web.UI.WebControls.DataGridLinkButton" Then
dglb = DirectCast(c, LinkButton)
dglb.Attributes.Add("onclick", "if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); ")
End If
Next i
End If

"Mehdi" <(E-Mail Removed)> wrote in message
news:OHVc$(E-Mail Removed)...
> Hi,
>
> Does anyone know how to set Causesvalidation =true; when paging. I need

to
> call my custom validator.
>
> Thanks for the help in advance.
>
> Regards
>
>
> Mehdi
>
>



 
Reply With Quote
 
 
 
 
Mehdi
Guest
Posts: n/a
 
      05-24-2004
Thanks Rick,

I will try it.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
validate method and causesvalidation Martin ASP .Net 3 05-21-2005 04:55 PM
advanced question: making <asp:ButtonColumn> CausesValidation=False z. f. ASP .Net 4 06-25-2004 07:51 PM
why <asp:ButtonColumn> for datagrid doesn't have CausesValidation property like <asp:Button> z. f. ASP .Net 4 06-23-2004 07:26 AM
CausesValidation of editcommandcolumn George Durzi ASP .Net 1 02-12-2004 02:40 AM
CausesValidation not taking in Repeater control Josh Anderson - remove Zs to reply ASP .Net 0 11-20-2003 11:37 PM



Advertisments