what is the purpose of e.NewValues inside the GridView1_RowUpdating routine?
i've seen examples where you findControl then assign that value to
e.NewValues, but that seems like an extra step.
thanks,
rodchar"rodchar" <rodchar@.discussions.microsoft.comwrote in message
news:355B7331-25E9-4E98-BDC7-A7D8D9BC0C52@.microsoft.com...
Quote:
Originally Posted by
hey all,
what is the purpose of e.NewValues inside the GridView1_RowUpdating
routine?
Quote:
Originally Posted by
i've seen examples where you findControl then assign that value to
e.NewValues, but that seems like an extra step.
>
thanks,
rodchar
I use is to validate serverside. Here is an example
Sub EmailGrid_Updating(sender as object, e as GridViewUpdateEventargs)
'Check format of new data
dim bCancel as boolean = false
msg1.text = string.empty
dim strEmailAddress as string = string.empty
if not e.newvalues(0) is nothing then
strEmailAddress = Server.htmlencode(e.newvalues(0).tostring())
end if
BCancel= Regex.IsMatch(strEmailAddress,
"^([\w-\.]+)@.((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-
Z]{2,4}|[0-9]{1,3})(\]?)$")
if BCancel then
dim strDate as string = string.empty
if not e.newvalues(2) is nothing then
strDate = Server.htmlencode(e.newvalues(2).tostring())
BCancel = IsDate(strDate)
if BCancel then
if (year(ctype(strDate,datetime)) < 2000) then
BCancel = false
end if
if not bCancel then msg1.text = "Invalid Date"
end if
else
msg1.text = "Invalid Email Address"
end if
e.Cancel = not bCancel
End sub
thank you i'll take a look.
"vMike" wrote:
Quote:
Originally Posted by
>
"rodchar" <rodchar@.discussions.microsoft.comwrote in message
news:355B7331-25E9-4E98-BDC7-A7D8D9BC0C52@.microsoft.com...
Quote:
Originally Posted by
hey all,
what is the purpose of e.NewValues inside the GridView1_RowUpdating
routine?
Quote:
Originally Posted by
i've seen examples where you findControl then assign that value to
e.NewValues, but that seems like an extra step.
thanks,
rodchar
>
I use is to validate serverside. Here is an example
>
Sub EmailGrid_Updating(sender as object, e as GridViewUpdateEventargs)
'Check format of new data
dim bCancel as boolean = false
msg1.text = string.empty
dim strEmailAddress as string = string.empty
if not e.newvalues(0) is nothing then
strEmailAddress = Server.htmlencode(e.newvalues(0).tostring())
end if
BCancel= Regex.IsMatch(strEmailAddress,
"^([\w-\.]+)@.((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-
Z]{2,4}|[0-9]{1,3})(\]?)$")
if BCancel then
dim strDate as string = string.empty
if not e.newvalues(2) is nothing then
strDate = Server.htmlencode(e.newvalues(2).tostring())
BCancel = IsDate(strDate)
if BCancel then
if (year(ctype(strDate,datetime)) < 2000) then
BCancel = false
>
end if
if not bCancel then msg1.text = "Invalid Date"
end if
else
msg1.text = "Invalid Email Address"
end if
e.Cancel = not bCancel
End sub
>
>
>
0 comments:
Post a Comment