Convert a TextBox in a DataForm WebPart to a DropDownList
Your TextBox control will appear like this
<asp:textbox id="ff2{$Pos}" runat="server" bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'Text','TextChanged','Property_ID',ddwrt:EscapeDelims(string(@Property_ID)),'@Property_Type')}"></asp:textbox>
Change “TextBox “ to “DropDownList”
Change “Text” to “ SelectedValue”
Change “TextChanged” to “ SelectedIndexChanged”
And don't forget add a property “FieldName”:eg:FieldName=”@fieldname”
<asp:dropdownlist id="ff2{$Pos}" fieldname="Property_Type" runat="server" bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'SelectedValue','SelectedIndexChanged','Property_ID',ddwrt:EscapeDelims(string(@Property_ID)),'@Property_Type')}" ></asp:dropdownlist>
Full Code including the DataSource will look like this
<asp:dropdownlist id="ff2{$Pos}" fieldname="Property_Type" runat="server" bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'SelectedValue','SelectedIndexChanged','Property_ID',ddwrt:EscapeDelims(string(@Property_ID)),'@Property_Type')}" datatextfield="Property_Type_ID" datasourceid="SqlDataSource10" datavaluefield="Property_Type_ID"></asp:dropdownlist>
Thursday, May 21, 2009
Subscribe to:
Posts (Atom)