1. Make sure you have a validation function set up for updates in aspx page (mine is called DataUpdateCO):
%26lt;ASP:DATAGRID id=';MyChangeOverDataGrid'; runat=';server'; OnUpdateCommand=';DataUpdateCO'; BackColor=';LightBlue';%26gt;
2. Do validation by using ';.FindControl'; from the DataGridCommandEventArgs obj. My controls name is ';CO_ID';.
Sub DataUpdateCO(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim txtID As Integer = CInt(CType(E.Item.Cells(0).FindControl(';鈥?Label).Text)
If txtID = ';'; then
Msg.TExt = ';Error the ID is empty!
'do not update the grids data and re-bind
Else
'update the drids data and re-bind
End IF
End SubHow can i Validate a Datagrid??????
Use regular expression validator control
No comments:
Post a Comment