开发者

ListView databinding behavior

I have what I think to be an odd problem with listview databinding.

I am calling a protected method on my code-behind called ItemHtml() - as seen below.

    <ItemTemplate>
        <div class="itemWrapper">
            <%# ItemHtml() %>
        </div>
    </ItemTemplate>

The method is defined as follows.

protected string ItemHtml()
{
    string itemHtml =
        StateHeaderIfNewState()
           + ActivityOwnerIfNew()
           + ActivityCategoryIfNew()
           + ActivityDescriptionHtml()
   开发者_如何学Go        + TaskDescriptionHtml()
           + RecordDetailsHtml();   
    Trace.Write("DEBUG", itemHtml);
    return itemHtml;
}

The trace shows an "itemHtml" like the following (I've removed the actual html from the code to ensure it's not just invalid html): Virginia, Activity Owner Name, Category, Activity, Task, Details

However, the page source is missing the first two values (begins with "Category").

Am I misunderstanding something about listview databinding? How could the trace have one value, but the source have another?


Your "View Source" click is generating a new http request causing a new call to the server which now has a new response (presumably due to the logic implied by "IfNew"). In my opinion, it is not possible for your itemHtml variable to have the two different values you describe at the same time.

If I am correct, you should have multiple traces as a result of the multiple requests.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜