Results 1 to 6 of 6

Thread: width on grid view

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    194

    width on grid view

    I have a grid view that take the data from the DB.

    if the row is big
    example:
    "nd bhdjhhd jh jhfd jh gjhdf gjhgdfs jhdg jhdjhdg fhjhdgf jhsdjfh jdshfg aydufygd uyfg uysg fuy adusygjh j gjh gcdys duf gudshcghsd dcjhdfusdhgdsygusa hdgfuysagdcuy sgcuysgu ycgusychxsajhdgusycg hcghsudyfgsduyf uasygjhsc bjsjhdguhguah dyguhyyg uyf uydgf uydsg fuysgd fuysdg ufyssuyfg uygsuygfds"

    (with no ENTERS)
    than the width of the gridview changed,
    I want that if the text is big to break the line and not to change the width.


    example in the picture.

    thanks
    Attached Images Attached Images  

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: width on grid view

    I would recommend that you write your own handler for each data loading event of the data grid.

    Evaluate the data in that cell and if it is larger than a certain number of characters, change the data and insert the carriage return yourself. Continue for the entire length of the data.

    Optionally, if you are OK with scrolling when this occurs, you can use a CSS style to force those cells to scroll. If you want to do that, add the following style to the datagrid datacell:

    style="width=XXXpx; height=XXXpx; overflow:scroll"
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    194

    Re: width on grid view

    thanks!

    I think I will use the scroll

    thanks again!

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: width on grid view

    In the ItemStyle tag of the datagrid, set Wrap="True"

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    194

    Re: width on grid view

    I got the mistake, but I dont know how to fix it.

    if the paragraph is with ENTER I want to show the ENTERS

    in VB I use the replace function

    dim str as string

    str = replace(filedName, vbcrlf, "<BR>")

    but now I work with c# and I cant to replace the vbcrlf to BR then I use the HTML TAG
    <pre>
    <%=filedName %>
    <pre>

    then when I use the PRE if there not ENTER the width of the grid view changed.

    how can I
    from one side show the ENTERS (if there are)
    from other side if there is no enters break lines.

    hope to understand me
    thanks!

  6. #6
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: width on grid view

    VB: "string" & vbCrLf & "string"
    C#: "string\r\nstring"
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width