开发者

Are there any difference between aspx and code behind when assigning text values asp.net 4.0 c#

This is code behind assigning aspx.cs

      if (srLang == "tr")
    {
        lblUn开发者_开发问答WantedPrivateMessages.Text = "Özel Mesaj Almak İstemediğiniz Oyuncular";
        lblPmBlockUserNameTitle.Text = "Oyuncu Adı:";
    }
    else
    {
        lblUnWantedPrivateMessages.Text = "Players That You Don't Want To Receive PM";
        lblPmBlockUserNameTitle.Text = "Player Name:";
    }

and this is aspx assigning

    <%    
    if (srLang == "tr")
    {
        lblUnWantedPrivateMessages.Text = "Özel Mesaj Almak İstemediğiniz Oyuncular";
        lblPmBlockUserNameTitle.Text = "Oyuncu Adı:";
    }
    else
    {
        lblUnWantedPrivateMessages.Text = "Players That You Don't Want To Receive PM";
        lblPmBlockUserNameTitle.Text = "Player Name:";
    }
     %>

Are there any performance difference between these 2 ?


Both will compile into equivalent code, and there will be no performance difference.

Placing significant code in the code behind file allows for a separation of responsibilities (display markup in the aspx file, logic in the code behind file) and leads to code that is easier to maintain.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜