wbb Posted April 2, 2004 Posted April 2, 2004 i having datagrid column size's problem ...if the grid does not have enough item number i set in page size...the grid's column will become BIG and UglY...anyone here know hw to set it a standard fixed size .... Quote
Moderators Robby Posted April 3, 2004 Moderators Posted April 3, 2004 If you don't allow wrap the column will get very wide, if you do allow wrap it will get very tall. I prefer to limit the amount shown in that column/cell to a pre-determined length....You can place a button or something to allow the user to select then view the entire content in a textArea. [size=2][color=#0000ff]Public[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] LimitChars([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] s [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Object[/color][/size][size=2]) [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size] [color=#0000ff] [size=2]If[/size][/color][size=2] IsDBNull(s) [/size][size=2][color=#0000ff]Then[/color][/size] [color=#0000ff] [size=2]Return[/size][/color][size=2] ""[/size] [size=2][color=#0000ff]Else[/color][/size] [color=#0000ff] [size=2]Dim[/size][/color][size=2] ss [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2] = Convert.ToString(s)[/size] [size=2][color=#0000ff]Dim[/color][/size][size=2] len [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer[/color][/size][size=2] = ss.Length[/size] [size=2][color=#0000ff]If[/color][/size][size=2] len > 30 [/size][size=2][color=#0000ff]Then[/color][/size] [size=2]len = 30[/size] [size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If[/color][/size] [color=#0000ff] [size=2]Return[/size][/color][size=2] ss.Substring(0, len)[/size] [size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If[/color][/size] [size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Function [/color][/size] In your aspx page, Label or Literal text... text='<%# LimitChars(DataBinder.Eval(Container, "DataItem.myColumn")) %>' Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.