ASP:textbox default value not binding to SharePoint List\SQL database

376 views Asked by At

In SharePoint Designer 2010, I created several External Content Types that are from a SQL database (SQL 2012). I created the lists and created the associations between them, and on the main list, under Forms, I clicked New, and created a new Edit Form and made that the default. I designed the form the way that I wanted it to look.

I have a asp:textbox that is bound to a field called, AUTHORS_USERNAME, where I am displaying the user's name who is editing this record (see below) however when the user clicks the Save button, it doesn't save or bind the information to the list\database.

(<asp:TextBox runat="server" id="ff32{$Pos}" Name="Author" text="{$UserName}" __designer:bind="{ddwrt:DataBind('u',concat('ff32',$Pos),'Text','TextChanged','',ddwrt:EscapeDelims(string('')),'@AUTHORS_USERNAME')}" />)

I believe it has to do with the 'TextChanged'; can someone recommend a workaround for this?

Thank you.

1

There are 1 answers

0
Benjamin Warren On BEST ANSWER

Use the value attribute instead: value="{$UserName}".

I was having a similar problem, but just trying to use a querystring value as the default.

In my case, if I edited the resulting input control once the page had loaded and I put a DIFFERENT value there, it'd save, but it wouldn't save the default value I was providing via the Textbox text attribute. I'm guessing SharePoint is thinkin' that the value hasn't changed because it's the same as when the page was loaded.

The solution was to put it in the value attribute instead: value="{$UserName}" in your case, and don't put in a text attribute at all.