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() +" "+ eval("username").tostring().padright(20).substring(0,5).trimend() +" "+ 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
Post a Comment