ASP.NET datagrid is cutting off bound text column

Discussion in 'ASP .Net' started by Dave, Feb 2, 2006.

  1. Dave

    Dave Guest

    I have a datagrid in my asp.net page (using VS 2003). One of the columns is bound to a text field. The length of some of these text field values is more than 255 characters but when the grid displays it cuts off the text displayed in the grid at 255 characters. How do I change this??

    I am creating my connection and command objects like this in the page load event...
    Dim oConn As SqlClient.SqlConnection = New SqlClient.SqlConnection
    Dim cmd As SqlClient.SqlCommand

    oConn.ConnectionString = "Data Source=MBSQL1\MBAPPS;Initial Catalog=MainDB;User Id=someuser;Password=somepwd"

    cmd = New SqlClient.SqlCommand("SELECT ReportLoc, PreviewImgLoc, DisplayName, ReportDescr FROM vwMainDBView WHERE IsMgrReport = 0 AND GroupID = " & lGrpID & " ORDER BY DisplayName", oConn)

    Dim da As SqlClient.SqlDataAdapter = New SqlClient.SqlDataAdapter(cmd)
    Dim ds As New DataSet
    da.Fill(ds, "vwMainDBView")

    dgGrid.DataSource = ds
    dgGrid.DataMember = "vwMainDBView"

    The field ReportDescr is the one that is being truncated at 255 characters. The field in the SQL Server db is a varchar(5000) field. Any help would greatly be appreciated. If there is more info you need please let me know what it is.


    Posted via DevelopmentNow.com Groups
    http://www.developmentnow.com
     
    Dave, Feb 2, 2006
    #1
    1. Advertising

  2. You can control the width of columns using the
    ..GridColumnStyles["Title"].Width attribute.

    A quuck search on google came up with these two examples that might help
    you.

    http://support.microsoft.com/?id=812422

    http://www.freevbcode.com/ShowCode.asp?ID=4473

    --
    Regards

    John Timney
    Microsoft MVP

    "Dave" <> wrote in message
    news:...
    >I have a datagrid in my asp.net page (using VS 2003). One of the columns is
    >bound to a text field. The length of some of these text field values is
    >more than 255 characters but when the grid displays it cuts off the text
    >displayed in the grid at 255 characters. How do I change this??
    >
    > I am creating my connection and command objects like this in the page load
    > event...
    > Dim oConn As SqlClient.SqlConnection = New SqlClient.SqlConnection
    > Dim cmd As SqlClient.SqlCommand
    >
    > oConn.ConnectionString = "Data Source=MBSQL1\MBAPPS;Initial
    > Catalog=MainDB;User Id=someuser;Password=somepwd"
    >
    > cmd = New SqlClient.SqlCommand("SELECT ReportLoc,
    > PreviewImgLoc, DisplayName, ReportDescr FROM vwMainDBView WHERE
    > IsMgrReport = 0 AND GroupID = " & lGrpID & " ORDER BY DisplayName", oConn)
    >
    > Dim da As SqlClient.SqlDataAdapter = New
    > SqlClient.SqlDataAdapter(cmd)
    > Dim ds As New DataSet
    > da.Fill(ds, "vwMainDBView")
    >
    > dgGrid.DataSource = ds
    > dgGrid.DataMember = "vwMainDBView"
    >
    > The field ReportDescr is the one that is being truncated at 255
    > characters. The field in the SQL Server db is a varchar(5000) field. Any
    > help would greatly be appreciated. If there is more info you need please
    > let me know what it is.
    >
    >
    > Posted via DevelopmentNow.com Groups
    > http://www.developmentnow.com
     
    John Timney \( MVP \), Feb 2, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Paul

    Response cutting off

    Paul, Apr 9, 2007, in forum: ASP .Net
    Replies:
    8
    Views:
    519
    George Ter-Saakov
    Apr 10, 2007
  2. Matt Haggard

    PIL cutting off letters

    Matt Haggard, Jun 15, 2007, in forum: Python
    Replies:
    4
    Views:
    311
  3. Joey Martin

    form field cutting off querystring

    Joey Martin, May 18, 2004, in forum: ASP General
    Replies:
    3
    Views:
    158
    Joey Martin
    May 18, 2004
  4. zz12
    Replies:
    2
    Views:
    151
  5. trans.  (T. Onoma)
    Replies:
    2
    Views:
    97
    trans. (T. Onoma)
    Oct 31, 2004
Loading...

Share This Page