Using Code to Avoid DB.Null

D

Derek Martin

I am submitting forms in SP1 (VB.Net code behind) into a Sharepoint library.
I have some checkboxes that I would like to set on load to the value of 0.
Since it is on load, the boxes won't have any value (db.null, nothing, etc.)
This is what I have so far:
....
'Sets unchecked values in permissions to no
Dim permittimenodeask As IXMLDOMNode
permittimenodeask =
thisXDocument.DOM.selectSingleNode("/my:myFields/my:permittime")

If permittimenodeask Is Nothing Then
permittimenodeask.text = "0"
End If
.....
For permittimenodeask, this doesn't appear to be working, at least not from
a stack trace that I can tell. Anyone know of any ideas?
 
M

Matthew Blain \(Serriform\)

What do you mean by 'is not working'? If the node is present, it won't be
nothing. If it is nothing, then you can't use the .text value of it, since
you can't access the text value of 'nothing'. Instead you'll have to create
a node and insert it into a tree.

Anyway, this probably isn't the best solution. If you want to set the
default value of a node, right-click on the node in the data source and
bring up the properties dialog. Then set the default value to 0 or whatever
other value you want it to be. In SP-1, this can even be used to set a
node's value dynamically with a forumla.

--Matthew Blain
http://tips.serriform.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top