Regardign implementing Custom ExpressionBuilder.
- by Puneet Dudeja
I want to pass the "DisplayName" column value returned from SqlDataSource's Select command to a custom function and then the return value to be assigned to "DataTextField" property of DropDownList.
I know, I can do this using "CustomExpressionBuilder", I have tried but if I use following:
DataTextField="<%$ MyCustomExpressionBuilder:DisplayName %>"
I do not receive the value of the DisplayName field in the overriden "GetCodeExpression" method, but the literal value "DisplayName".
How can I do this? Please help me.
<asp:DropDownList ID="drpCourseType" runat="server" DataSourceID="sqldsCourses"
DataTextField="DisplayName" DataValueField="Type" CssClass="FilterDropdown">
</asp:DropDownList>
<asp:SqlDataSource runat="server" ID="sqldsCourses"
SelectCommand="SELECT Type,DisplayName FROM CourseTypes ORDER BY OrderID"
ConnectionString="<%$ ConnectionStrings:connectionString %>"></asp:SqlDataSource>