473,385 Members | 1,582 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,385 software developers and data experts.

Binding and controlling values which go into data source

I am trying to use data binding to avoid having to write event
handlers everywhere for my data transfer from controls to data source
and all is working well except, i have a condition i would like to
place on the value before i let it go through. I have built an
expression evaluator to determine when something is valid versus
invalid.

My problem is that when i trap the format event of the data binding, i
can get to the value before it goes into the control but what i can't
figure out is how to stop the actual value from getting there when the
eval says it is not valid.

Example:
I have a simple binding set up for a text box to go to another text
box but i only want the 2nd text boxes value to update when the first
one is alpha numeric. So in the format event i can put something like
if ce.DesiredType is GetType(String) then Return else ...
This is where i come up scratching my head. how can i essentially say
Cancel the request to send the value over. It might be something
simple i am missing but i can't find it.

Thoughts?
Nov 20 '05 #1
2 1290
Look at the validating event
-----Original Message-----
I am trying to use data binding to avoid having to write eventhandlers everywhere for my data transfer from controls to data sourceand all is working well except, i have a condition i would like toplace on the value before i let it go through. I have built anexpression evaluator to determine when something is valid versusinvalid.

My problem is that when i trap the format event of the data binding, ican get to the value before it goes into the control but what i can'tfigure out is how to stop the actual value from getting there when theeval says it is not valid.

Example:
I have a simple binding set up for a text box to go to another textbox but i only want the 2nd text boxes value to update when the firstone is alpha numeric. So in the format event i can put something likeif ce.DesiredType is GetType(String) then Return else ...
This is where i come up scratching my head. how can i essentially sayCancel the request to send the value over. It might be somethingsimple i am missing but i can't find it.

Thoughts?
.

Nov 20 '05 #2

There are two problems with Validate.
1) It doesn't fire until you press enter or leave the field
2) it doesn't let you get to the value BEFORE databinding occurs.
The format and parse events from the binding are the only way, that i
can tell, to get to the value before it actually gets put into the
source in question. SO validate doesn't work.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3

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

Similar topics

0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
3
by: amber | last post by:
Hello, I have 6 comboboxes, that I thought I could bind to the same datasource, and have them display different 'selectedvalue's', but apparently I can't... My code is as follows: dim drv as...
2
by: bmayer | last post by:
I am using a detail view and binding it to a sql data source (at some point in the future it will be an object data source). I have seen the article "Working with Data is ASP.NET 2.0 ::...
3
by: Simon Tamman | last post by:
I've come across an interesting bug. I have workarounds but i'd like to know the root of the problem. I've stripped it down into a short file and hope someone might have an idea about what's going...
3
by: Max | last post by:
Hello, I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated in the form load method. The combo box has item ids. When...
3
by: RobertTheProgrammer | last post by:
Hi folks, I've got another problem. Basically, I'm trying to use a nested GridView, however the nexted GridView displays no values (even though in debug I'm getting valid values into my DataSet. ...
0
by: Armin Zingler | last post by:
<Just_a_fan@home.netschrieb After having longer discussions about a similar issue, I ask you to provide an example of the source and destination value(s) and their data types. Thanks. Example...
0
by: diff | last post by:
I am having trouble preventing a bound source from updating using event-driven validation. There is a very nice article on MSDN explaining this;...
2
by: =?Utf-8?B?Q29sb3JzdG9uZQ==?= | last post by:
Hi, I have a TabContainer inside a data bound FormView (to logically group the form fields into different tabs). The display part of the data binding works fine, but the Update doesn't. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.