How to show full message when clicking on message tag in asp.net?

I am currently displaying the complete message at a time in a label in a grid like this.

<asp:TemplateField HeaderText="Message" ItemStyle-CssClass="gridlabeltextleftalign"> <ItemTemplate> <div style="word-wrap: break-word; width: 240px; text-align: left"> <asp:Label ID="lblMessage" runat="server" Font-Size="12px" Text='<%#DataBinder.Eval(Container.DataItem, "Message") %>'></asp:Label> </div> </ItemTemplate> </asp:TemplateField> 

I want to display a message in one line when I click on it, and then display the entire message.

Tell me.

+6
source share
1 answer

first displays a string of fixed length (not a complete message -> for example: mes ...).

Declare a secure line in the page load, and then bind it in each page load. After that, directly assign the protected string to the javascript array.

see code below:

In page load mode

  protected string protectedString = ""; 

In the Javascript function to be called in the MouseOver event:

  JavascriptArray = "<%= protectedString %>"; 

Define the array as innerHTML DIV.

Hope this helps ...

+1
source

Source: https://habr.com/ru/post/888983/


All Articles