asp.net - how to add space if string only 2 and max is 5? -


current doing asp.net c#. use eval() data data base , set length of data. has idea how it?

<asp:linkbutton id="linkbutton1" onclick="linkbutton1_click"  text='<%# eval("userid").tostring().padright(20).substring(0,5).trimend() +"&nbsp;&nbsp;&nbsp;&nbsp;"+ eval("username").tostring().padright(20).substring(0,5).trimend() +"&nbsp;&nbsp;&nbsp;&nbsp;"+ eval("userposition").tostring().padright(20).substring(0,5).trimend()%>' runat="server"></asp:linkbutton> 

here sample code of how data. tried out show quite nice if data more 5. alignment ugly if data less 5.

add function in page code , pass parameters it: text='<%#yourmethod(eval("userid")) %>'. alternatively concatenate these values create new string in database layer, , add new string new class property. text='<%#eval("newstring")%>


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -