user3339242
user3339242

Reputation: 641

Another way to use <%# Bind %>

I am trying to use the Bind Property <%# Bind %> however I am joining many tables and I am unable to use the column with the name c.FormID because of the dot. When debugging it only sees it as "c".

Is there a way to get around this?

My code:

SelectedValue='<%# Bind("c.FormID") %>'

Heres my sql code:

SELECT c.FormID, FormSectionSubSectionItemRelID,c.ControlTypeID,c.FormSectionID,c.SubSectionID,c.SectionItemID,c.ValidationRulesetId,c.CrossItemID, FormTitle, FormSection ,SubSection, SectionItem, SortOrder, SectionSortOrder,SubSectionSortOrder, RulesetDesc,ControlType, CrossItem  FROM Core. Form_Section_SubSection_Item_Rel c
FULL OUTER JOIN Core.FormSection_Lkup l
ON c.FormSectionID = l.FormSectionID FULL OUTER JOIN Core.FormSubSection_Lkup s
ON c.SubSectionID = s.SubSectionID FULL OUTER JOIN Core.SectionItem_Lkup i
ON c.SectionItemID = i.SectionItemID FULL OUTER JOIN Core.Form_Lkup f
ON c.FormID = f.FormID FULL OUTER JOIN Core.ValidationRuleset v
ON c.ValidationRulesetId = v.ValidationRulesetId FULL OUTER JOIN Core.ControlType_Lkup  t
ON c.ControlTypeID = t.ControlTypeID FULL OUTER JOIN Core.CrossItem_Lkup g
ON c.CrossItemID = g.CrossItemID  WHERE [DataCollectionPeriodID] = 74 ORDER BY FormTitle,FormSection

Upvotes: 0

Views: 24

Answers (2)

Dennis R
Dennis R

Reputation: 3237

You have to give a alias name for c.FormID as FormID in the select statement and use the alias name in the binding. Change the below statement

SELECT c.FormID, FormSectionSubSectionItemRelID, ...

to

SELECT c.FormID as FormID, FormSectionSubSectionItemRelID, ....

and then refer FormID in the binding

SelectedValue='<%# Bind("FormID") %>'

Upvotes: 1

JLane
JLane

Reputation: 514

The column's name is FormID, the c.FormID is just telling the statement to use table c, not actually naming the column "c.FormID"

Upvotes: 0

Related Questions