473,395 Members | 1,554 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

the meaning of life and gridview's e.newValue

hey all,
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
Oct 23 '06 #1
2 5581

"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:35**********************************@microsof t.com...
hey all,
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
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
Oct 24 '06 #2
thank you i'll take a look.

"vMike" wrote:
>
"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:35**********************************@microsof t.com...
hey all,
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

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
Oct 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
19
by: ccwork | last post by:
Hi all, I am reading "C: A Reference Manual" 4th ed and I get lost for the "extern". It says that global object without specifying the storage-class specifier will have "extern" as the default...
6
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the...
0
by: Peter | last post by:
Hi,everyone, I'm using a listview control to deal with data. The ItemCheckEventArgs have 2 properties:CurrentValue and NewValue in listview.itemcheck event. Can anybody tell me when does the...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
1
by: koren99 | last post by:
Hello, I have a gridview that is filled with a datasource & template fields dynamically. ( that has to be done because i ask the user for a datasource) anyway, i started out creating a static...
3
by: Peter | last post by:
I have a GridView which is populated by List<ofObjects> Does anyone have example of how to sort the columns of this GridView? I have found examples without DataSourceControl but these use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.