0

I have a textbox that represents a primary key in my database. Because the values are nvarchars I can't automatically increment for a new insert. Instead I have to read a value from a drop-down, perform some magic, and create a new incremented value for the new insert.

I've written codebehind that does all this when the drop-down is selected. It works, in that it puts correct values into the textbox. However when I try to insert, I get an error that that field cannot be null.

I'm pretty sure it's because I'm doing this in the codebehind :

myTextBox.text = newValue

which wipes out the binding the textbox should have :

Text='<%# Bind("UniqueName")

How can I calculate the needed value for this field programmatically and set it back to the screen so the user can see it (and possibly override it) and still keep the databinding intact so I can create the new record?

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by codeamazon
0
Text='<%# Bind("UniqueName")

Oops... actually looks like this of course :

Text='<%# Bind("UniqueName") %>'

Before I added the codebehind this worked, but I presume when I set the text I wipe it out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.