Is it possible to modify Databound content on the fly?
<p>Sorry if the post title wasn't clear, I will try to explain a little better here.</p>

<p>I am working with a web control that is databound to a data table. The output of the data is as such:</p>

<pre><code>&lt;asp:Repeater ID="RssRepeater" Visible="false" EnableViewState="false" runat="server"&gt;
    &lt;asp:literal ID="sb_description" Text='&lt;%# DataBinder.Eval (Container.DataItem, "description") %&gt;' EnableViewState="false" runat="server" /&gt;
    ''// Rest of structure...
&lt;/asp:Repeater&gt;
</code></pre>

<p>I wrote a function that, in theory, should trim a passed string to a specified number of words:</p>

<pre><code>protected string CreateTeaser(string Post)
{
    int wordLimit = 50;
    System.Text.StringBuilder oSB = new System.Text.StringBuilder();

    string[] splitBy = new string[] { " " };

    string[] splitPost = Post.Split(splitBy,
                         System.StringSplitOptions.RemoveEmptyEntries);

    for (int i = 0; i &lt;= wordLimit - 1; i++)
    {
        oSB.Append(string.Format("{0}{1}", splitPost[i], 
                  (i &lt; wordLimit - 1) ? " " : ""));
    }

    oSB.Append(" ...");

    return oSB.ToString();
}
</code></pre>

<p>I tried this abomination:</p>

<pre><code>&lt;asp:literal ID="sb_description" Text='&lt;%= CreateTeaser(%&gt; &lt;%# DataBinder.Eval (Container.DataItem, "description") %&gt;&lt;%=); %&gt;' EnableViewState="false" runat="server" /&gt;
</code></pre>

<p>But of course it did not work. So, is it possible to use this function on the <code>Databinder.Eval( ... )</code> while it is inside this literal control? If so, how should I go about doing this? If not, what would be a possible alternative to what I am trying to do?</p>

<p>Thanks SO!</p>
