473,756 Members | 9,433 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1304
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
4805
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 manually inserted a row in the table bound to the Combo box. The InsertAt Method of adding a row just does not work. Hope this helps anyone with this problem. john
3
4586
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 datarowview = me.listbox1.selecteditem dim dtbDL as datatable = _dataset1.Tables(0) dim dtvDL as new dataview(dtbDL) dtvDL.RowFilter = "STR_ONE" = 'Matching Text'"
2
2611
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 :: Customizing the Data Modification Interface", and its description of how to turn one of the fields into a template field, then add a drop down list. I want to do the same thing except I want two drop down lists, with the second one populating its values...
3
7519
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 on. It's a simple program that loads a control onto a form and binds "Foo" against a combobox ("SelectedItem") for it's "Bar" property and a datetimepicker ("Value") for it's "DateTime" property. The DateTimePicker.Visible value is set to...
3
2445
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 the users selects an item from the combo box I'd like the 4 text boxes to get populated with the corresponding item information from the same dataset table row that the combo box is pulling it's info from. Is there an easy way of doing this besides...
3
2651
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. It's probably a binding issue somewhere, but I'm not sure where. Here's the ASP (slightly edited to remove verbosity): <asp:GridView ID="GridViewMain" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#999999" ...
0
865
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 (of an example): Source: byte array, content=243 123 45 98 12 Destination: a string containing hex representation of the values, seperated by blanks: "F3 7B 2D 98 0C"
0
1287
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; http://msdn.microsoft.com/en-us/library/ms229603.aspx It clearly states, "When you use data binding, the data in your control is synchronized with the data source during execution of the Validating event. If you cancel the Validating event, the data will not be synchronized with the data source."...
2
4507
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. Basically the FormView cannot find the TextBoxes inside the tab container's tab panels. Some of the forums say that it's because of the TabContainer's implementation (by design) of "INamingContainer", and a hack is to take control of the TabContainer's...
0
9303
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9117
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9679
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9676
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7078
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4955
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3141
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2508
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.