String Format Specifier in C# for with fixed length of strings in Gridview -
i trying display string fixed length (say 10 digits of strings) in grid view item template while binding, not find format specifiers string itself.
i can format specifiers (numbers{0:n}, floats & decimal (d), currency{0:c}, , date{1,8:yyyy} , percentage {0,3:p1},temperature: {0:f}, exponential, hexadecimal ... but not string itself)
i tried links: click here didn't work me.
my grid view have template field (item template)
<asp:templatefield headertext="notes"> <itemtemplate> <asp:label id="label_note" runat="server" text='<%# string.format("{0}", eval("defect_note").tostring()) %>' ></asp:label> </itemtemplate> </asp:templatefield> i need display 'notes column' in below grid max 10 digits. if exeeds should not show (can show on tooltip) if less 10 can show content.

i wanted display notes columns printf(" %8s" ,¬e) in c#. (in binding single line)
don't forget check null values.
notes.substring(0, math.min(notes.length, 10))
Comments
Post a Comment