Google-Apps
Hauptmenü

Post a Comment On: the urban canuk, eh

"Understanding SharePoint’s “ddwrt:DataBind” syntax"

15 Comments -

1 – 15 of 15
Blogger markpittsnh said...

Nice job, Bryan!

Hey, I've got a customized NewForm2.aspx, and am looking at this line in the xslt.

SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="New" FieldName="Body" __designer:bind="{ddwrt:DataBind(
'i',
concat('ff2',$Pos),
'Value',
'ValueChanged',
'ID',
ddwrt:EscapeDelims(string(@ID)),
'@Body')}"

Ideally, I want to be able to suppress the original content from the body whenever someone replies.

My first thought was to replace ddwrt:EscapeDelims(string(@ID)) with empty string ''. That didn't get me too far.

Any suggestions?

Cheers!

Mark

4:29 PM

Blogger bryan said...

Mark,

Not sure I follow your meaning by whenever someone replies but if you want to suppress the body, you're probably best to let the XSLT do that.

ie -

<xsl:if test=".....condition....">
<xsl:value-of select="@Body" disable-output-escaping="true" />
</xsl:if>

1:53 AM

Blogger Mina said...

Hi Bryan
thanks for this great post
I've searched a lot for this issue and found nothing till I found your post
thanks

6:35 AM

Blogger IdeasAnvil said...

Hi Bryan,

obviously late to the post, but this is more a philosiphical sharepoint developer question than specifically to do with "ddwrt:DataBind" and as a relative newcomer to this who shooting-match its this -

I came across your blog which helped me out a huge amount whilst looking for info on the "ddwrt:DataBind" syntax - now this syntax is surely something that every sharepoint developer sees every single day they are developing - yet as far as I can see there is almost nothing out there which details this core part of the sharepoint system

Is this becuase;

1. fiddling with this is actually the 'wrong way' - as far as there is ever a wrong way - to get things done?

2. alpha-sharepoint-developers who have worked it out dont want to share the inner secrets...

3. There is a better way to get things done client side than fiddling with ddwrt:DataBind?

Its all part of the Big Sharepoint Conspiracy to drive a sane developer nuts?

Any thoughst greatly apprecaited!

All the best

2:15 PM

Blogger mkamoski said...

I have to say that this statement "but it is really impressive" is, well, still a matter of debate, no? Regardless, I thank you for your efforts. -- Mark Kamoski

10:58 AM

Blogger Unknown said...

I know this is an old post but I hoped you might know why the DataBind event doesn't detect when you change the field from JavaScript. For example if you modify the selection of a DVDropDownList through JavaScript, the ddwrt:DataBind function doesn't pick up that change. Please help!

11:15 AM

Blogger bryan said...

@jabit - the ddwrt:databind is for the server control events which are triggered on postback. You may need to trigger the postback event from javascript in order to leverage client-side changes.

5:43 PM

Blogger Joe H said...

I get how this works in a DVWP, but what about a joined (linked) data source? I cant get this to work... i can view the data, but trying to update it produces an error. I'm thinking i have to specify which list the item that i want to update belongs to... I dont know how to do that and it doesnt look like any of these parameters hold a list id...

4:28 PM

Blogger Teddybeardog said...

I'm able to get the values but it's adding "string;#" before the value from the DVWP. I was going to attempt JS but read jabit's entry that doesn't work. Any ideas how to fix?

12:59 PM

Blogger bryan said...

@TeddyBearDog It's been a while since I've been in the SharePoint space (being doing a lot of WPF and mobile the last few years) but I have seen this syntax coming from SharePoint before. Certain SharePoint fields have complex structure and express their raw values with these delimiters (SPFieldUrlValue, SPFieldUser are a few good examples).

You'll either have to adjust your query to return the values you want, or use some string parsing in the Xslt to string out the values you don't want. Note that Microsoft's Xslt is based on 1.0 so there isn't a simple Replace function...

3:54 PM

Blogger Unknown said...

Nice Article, Bryan! I am using Sharepoint 2010 . I created the custom Edit Form in sharepoint designer for List "Customer". "Customer" has lookup column "Area"
I applied Filter on Dropdown list of "Area". but when I open Edit form of customer list Area is not selected Properly it the first Item of the "Area" Dropdown shows like that "alladin Clinic" how could I get the selected Value?

3:11 AM

Blogger kg said...

Thanks a lot. This helps to understand the __designer:bind

3:05 AM

Blogger Unknown said...

Hi Bryan,

I have 2 dropdown fields and would like to filter the 2nd one based on the selection on top. Is it possible to do it? Appreciate any help on this !

Thanks !

Sam

7:54 PM

Blogger spunon said...

Nice job man, great info.

5:21 PM

Blogger ImProudMama said...

I am using SharePoint Designer 2010, and I have an asp:textbox that is bound to a SharePoint External List (SQL table). I want the default of this textbox to be the user who is editing that record, which I found a way to do, however when the user clicks the Save button, this value does not save back to the list or SQL table. Do you have any suggestions?

Thank you.

4:30 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot