Folks, I am reading/writing data within an XML file. In my form I have a
label that is assigned to the UpdateDate field within the XML file. Within
the form I update the label to a different date. The code is below. The
issue I'm having is that the DataBinding doesn't seem to be behaving
correctly. The changed value of my "label" is not being written to the file
when AcceptChanges() is called. Instead, the original value from within the
XML file is being written. I noticed that each time I call "AcceptChan ges"
that my label is being updated with the original value within the XML file
before the write occurs. The value I placed within the label's text field is
being over-written. Why is this happening?
// This is my XML file.
<?xml version="1.0" standalone="yes "?>
<PlatformDriver s>
<SupportedPlatf orm>
<Platform>My Computer</Platform>
<CreationDate >7/27/2006</CreationDate>
<UpdatedDate> 7/28/2006</UpdatedDate>
</SupportedPlatfo rm>
<Drivers>
<Driver>
<PnPID>VEN_1023 &DEV_07A0</PnPID>
<Description>Sa mple 1 pnp device</Description>
<Version>1.10.A .0</Version>
<Comments>Thi s is a sample of 1</Comments>
<OSSupported> 1, 2</OSSupported>
</Driver>
<Driver>
<PnPID>VEN_8988 &DEV_1002</PnPID>
<Description>Sa mple 2 pnp device</Description>
<Version>2.20.B .0</Version>
<Comments>Thi s is a sample of 2</Comments>
<OSSupported> 1, 2, 3, 6</OSSupported>
</Driver>
</Drivers>
</PlatformDrivers >
This code binds my lable text property to the field within the XML file.
The value from my XML file (7/28/2006) is correctly shown within my form when
it first pulls up.
this.labelDateM odified.DataBin dings.Add(new Binding("Text",
this.myDataSet, "SupportedPlatf orm.UpdatedDate "));
This is where I write the values of my dataset back to the XML file. For
some reason, every time I call AcceptChanges() the label's current value is
being overwritten by the original value within the XML file before the data
is written back to the file. The odd thing is that any changes made within
my DataGridView for the drivers are correctly written to the file. Can
someone tell me why this is happening?
this.xmlDataSet .AcceptChanges( );
this.xmlDataSet .WriteXml(this. XmlFilePath());
--
-----------
Thanks,
Steve 1 2459
I did more digging and found that I needed to add this line after each of my
binding statements:
this.labelDateM odified.DataBin ding[0].DataSourceUpda teMode =
DataSourceUpdat eMode.OnValidat ion;
--
-----------
Thanks,
Steve
"SteveT" wrote:
Folks, I am reading/writing data within an XML file. In my form I have a
label that is assigned to the UpdateDate field within the XML file. Within
the form I update the label to a different date. The code is below. The
issue I'm having is that the DataBinding doesn't seem to be behaving
correctly. The changed value of my "label" is not being written to the file
when AcceptChanges() is called. Instead, the original value from within the
XML file is being written. I noticed that each time I call "AcceptChan ges"
that my label is being updated with the original value within the XML file
before the write occurs. The value I placed within the label's text field is
being over-written. Why is this happening?
// This is my XML file.
<?xml version="1.0" standalone="yes "?>
<PlatformDriver s>
<SupportedPlatf orm>
<Platform>My Computer</Platform>
<CreationDate >7/27/2006</CreationDate>
<UpdatedDate> 7/28/2006</UpdatedDate>
</SupportedPlatfo rm>
<Drivers>
<Driver>
<PnPID>VEN_1023 &DEV_07A0</PnPID>
<Description>Sa mple 1 pnp device</Description>
<Version>1.10.A .0</Version>
<Comments>Thi s is a sample of 1</Comments>
<OSSupported> 1, 2</OSSupported>
</Driver>
<Driver>
<PnPID>VEN_8988 &DEV_1002</PnPID>
<Description>Sa mple 2 pnp device</Description>
<Version>2.20.B .0</Version>
<Comments>Thi s is a sample of 2</Comments>
<OSSupported> 1, 2, 3, 6</OSSupported>
</Driver>
</Drivers>
</PlatformDrivers >
This code binds my lable text property to the field within the XML file.
The value from my XML file (7/28/2006) is correctly shown within my form when
it first pulls up.
this.labelDateM odified.DataBin dings.Add(new Binding("Text",
this.myDataSet, "SupportedPlatf orm.UpdatedDate "));
This is where I write the values of my dataset back to the XML file. For
some reason, every time I call AcceptChanges() the label's current value is
being overwritten by the original value within the XML file before the data
is written back to the file. The odd thing is that any changes made within
my DataGridView for the drivers are correctly written to the file. Can
someone tell me why this is happening?
this.xmlDataSet .AcceptChanges( );
this.xmlDataSet .WriteXml(this. XmlFilePath());
--
-----------
Thanks,
Steve
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: serge calderara |
last post by:
Dear all,
I have a label control on a form for which the .Text property is update from
a dataset field.
Then on the same page I have place an Hyperlink control fore which when
click, it jump to an url with the lable.Text property as parameter
For that I have done it as follow :
</asp:label><asp:label id="lblReelId" runat="server" </asp:label>
|
by: oracle |
last post by:
Greetings,
I have a combo box that I binded to a data set using text and tags. I
want it to display the DRT.Name property and have a DRT.UnitId as a
value.
this.drtComboBox.DataBindings.Add(new
System.Windows.Forms.Binding("Tag", this.drtDataSet1, "DRT.UnitId"));
this.drtComboBox.DataBindings.Add(new
System.Windows.Forms.Binding("Text", this.drtDataSet1, "DRT.Name"));
|
by: cannontrodder |
last post by:
I am displaying names and other details of my users in a Formview
control by binding my custom business object to it. My custom object
also has a property that is a collection of boolean values and I would
like to show a checkboxlist within my formview to represent them.
I just have no idea how to bind this collection to a list within the
formview? Has anyone got any ideas on this? I don't need the full code,
just a pointer in the right...
|
by: Eric |
last post by:
Simple problem - binding Visible property of label to Checked
property of radiobutton on the same form.
How do I do that in VS2005??
Visible="<%# radiob.Checked %>" - DOESN'T WORK
It was so simple in 2003 but how it can be done in VS05
using binding expressions. Theres no controls listing under 'Expressions'
on the designer properties window.
Please help.
Eric
|
by: =?Utf-8?B?QXNo?= |
last post by:
Hi,
I have an object, for example User. User contains various properties which i
have been able to bind to successfully using wizards and the form view.
However if the class User has a property which is not a string, for example
a custom type Address which contains properties such as StreetAddress, City,
County, Country etc how do i bind to those properties on the same form view?
I have tried doing Bind("Address.StreetAddress") but...
| |
by: Stephen Barrett |
last post by:
I have an application that was originally built with ASP.Net 1.1.
We finally got permission to migrate to 2.0. Due to time constraints we
migrated the web projects to 2.0 web application projects to minimize
required changes initially.
I am stuck on a problem using a data grid.
I have a usercontrol that has a DataGrid on it. The datagrid has an item
template that loads another common user control for every row. I am getting
|
by: Dmitry Duginov |
last post by:
Hi,
I have the following label markup (label is inside FormView):
<asp:Label
ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready"
BackColor='<%#
Eval("Ready").ToString()=="True"?System.Drawing.Color.FromName("#FFFF80"):System.Drawing.Color.White
%>'
Enabled='<%# Eval("Ready") %>'
|
by: =?Utf-8?B?VGVycnk=?= |
last post by:
Think it is great the way that you can set up a datsource, value member, and
display member for a combobox, and map a 'code' to a 'description' and back
again by binding the combobox to a datasource that contains the code. Now
suppose that you want it to be read-only? That is, you have the 'code' in
your DB, want the associated 'description' to display, but not let the user
change it on this particular form. There is no read-only...
|
by: Igor |
last post by:
Hi
I build a page that has a dropdownlist control bound with data from a
database. When user select an item from the dropdownlist I want a label to
be filled with a result from a stored procedure. The stored procedure takes
an ID of a selected item (@BoundID) from the dropdownlist and gives a result
(@BoundIdentifier) as follows:
---
Running . ( @BoundID =
|
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,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |