2012/06/17

Asp.net 動態變更Site.Map

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Handles Me.Load

Web.SiteMap.CurrentNode.ReadOnly = False

Web.SiteMap.CurrentNode.Title = "123"

Label1.Text = SiteMap.CurrentNode.Title

End Sub


--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.54.106

2012/06/15

IIF(Eval("value")) in ASP.Net

the Eval function doesn't exist in the current version of FIM. For a
complete list of available functions, go to the FIM home page, click on the
All Resources menu, and then on the Functions resource type.

The only option available to you AFAIK is to use nested IIF statements, e.g.

IIF (condition1,'value1',IIF(condition2,'value2','value3'))




--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 111.248.108.186

2012/06/13

Repeater.headertemplate 使用Bind/Eval

headertemplate 似乎無法使用 <%# Eval("name") %> 來做資料庫的欄位繫結

但 Repeater 控件也只能做單向繫結而已(讀出)

所以可以用以下方法

ASPX


<asp:repeater id="Repeater1" runat="server" datasourceid="SqlDataSource1">
        <headertemplate>
                <p>
                        <%# Message %>
                </p>
        </headertemplate>
        <itemtemplate>
                <%# Eval("Name") %>
        </itemtemplate>
        <separatortemplate>
                <br />
        </separatortemplate>
</asp:repeater>


CODE-BEHIND 的寫法則是

protected string Message
{
get {
         return "Hello World!";
      }
}

--
※ 發信站: 批踢踢兔(ptt2.cc)
◆ From: 114.36.62.79
→Corsair:http://forums.asp.net/t/1188170.aspx/1 推 06/13 11:14