.NETGURU
databinded checkbox
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngxml' list.


renevazquez@cimex.com.cu
Hello, I Have a html input control of type checkbox that I Bind to a
boolean element in a xml data island. When the element is true (of
course) the checkbox is checked and when is false is unchecked, but
when I click the checkbox to modify the value the resulting xml
document that I get the value of -1 if checked and 0 if not instead of
true or false wich is what I need. If someone knows why this happens
or if I have to do some extra Job please send me some tip:

here is the code that I use:

<xml id="dsoPart">
<dsPart>
<Parts>
<partNo>x1</partNo>
<descr>memoria Ram</descr>
<price>60</price>
<ret>false</ret>
<sentaiCode>123</sentaiCode>
</Parts>
</dsPart>
</xml>

<INPUT dataFld="ret" id="ret" title="ret" dataSrc="#dsoPart"
type="checkbox">

Reply to this message...
 
    
Kirk Allen Evans
Yep, we recently had the same issue. The integer value of true is "-1", and
false is "0". The reality is that True should be "anything that is
non-zero". If you are trying to send the XML into a database, and the value
goes into a field of type bit, then the insert will fail because -1 is not a
valid bit value. So, you have to muck around with the data somehow with an
extra step.

The solution lies partly with what you are doing with the posted XML:

1) Before submitting the XML, replace the value in the XML document using
the client-side DOM.
2) In a stored proc using OPENXML, then you can use the REPLACE function in
SQL Server.
3) In a COM component processing the XML, replace the value using a
server-side DOM.

If you are using OPENXML, you can declare the field's schema type as an
integer, and the actual column data type can remain as a bit type: SQL
Server will perform the conversion for you.

Kirk Allen Evans
http://www.xmlandasp.net
"XML and ASP.NET", New Riders Publishing
http://www.amazon.com/exec/obidos/ASIN/073571200X

[Original message clipped]

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification