How to use Single Quotes in Eval Format String

前端 未结 4 1151
北海茫月
北海茫月 2020-12-11 17:20

I\'ve got a Repeater and its SqlDatasource nested inside a Gridview TemplatedField.
The Repeater\'s datasource SelectCommand is set using the FormatString of an Eval fro

4条回答
  •  佛祖请我去吃肉
    2020-12-11 18:00

    Why don't you define this WHERE clause as a const in your codebehind. Define:

    protected const string SELECTCLAUSE = 
    "SELECT Blah FROM TableName WHERE (StringField = '{0}')";
    

    Then your SelectCommand property would be:

    SelectCommand='<%# Eval("Bar", SELECTCLAUSE ) %>'
    

提交回复
热议问题