How to manipulate title="" by C #?

3

Is it possible to put the text of the title="" attribute by c #? "

The title I want to manipulate is:

<asp:HyperLink runat="server" ID="linkTitle" CssClass="link_title search-result-link-title tooltip-init" Target="_top"  data-toggle="tooltip" data-placement="top" title="título" data-original-title="título" />
    
asked by anonymous 04.08.2016 / 00:35

2 answers

3

Property ToolTip !

<asp:HyperLink ToolTip="Aqui é renderizado o TITLE!">

I suggest you change the title of the question to ASP.NET, C # is the syntax used in ASP.NET!

No Code Behind uses the same property!

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink1.ToolTip = "TEXTO A SER RENDERIZADO NO TITLE DO ELEMENTO A HREF!";
        }
    }
}

    
04.08.2016 / 01:37
4

Using JavaScript, make an ajax request:

$.ajax({ 
          type: "POST",
          async: false,
          url: '@Url.Action("SetarTitulo", "Controller")',
          contentType: 'application/json',
          dataType: "json",
          data: JSON.stringify({ }),
          success: function (data) {
                   title = data.Retorno.Titulo;
                   $("#linkTitle title").html(title);
          }
      });

Controller:

    public JsonResult SetarTitulo(){

         var titulo = "Meu titulo";

         return Json(new RetornoAjax
         {
            Retorno = new
            {
                Titulo = titulo
            }
    });
}
    
04.08.2016 / 20:12