addnewrow not showing on formload

7 posts, 1 answers
  1. Emilio
    Emilio avatar
    15 posts
    Member since:
    Mar 2012

    Posted 07 May 2012 Link to this post

    Hi,

    allowaddnew row was set to true, on form load there's blank row in the grid but the "click here to add new row" was not shown, but when i clicked a column the text shows.  how can i show this message on form load?


    Thanks,
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 May 2012 Link to this post

    Hello, 

    I can't replicate this issue. Please try the following. 
    1: Drop a RadGridView onto a form. 
    2: Add the following code

    Public Class User
        Public Sub New(id__1 As Integer, name__2 As String)
            Id = id__1
            Name = name__2
        End Sub
     
        Public Sub New()
        End Sub
     
        Public Property Id() As Integer
            Get
                Return m_Id
            End Get
            Set(value As Integer)
                m_Id = Value
            End Set
        End Property
        Private m_Id As Integer
     
        Public Property Name() As String
            Get
                Return m_Name
            End Get
            Set(value As String)
                m_Name = Value
            End Set
        End Property
        Private m_Name As String
     
    End Class

    In form load
    Me.RadGridView1.AddNewRowPosition = SystemRowPosition.Top
    Me.RadGridView1.AllowAddNewRow = True
    Dim list As New List(Of User)()
    For i = 0 To 10
        list.Add(New User(i, "Name " & i.ToString()))
    Next
    Me.RadGridView1.DataSource = list

    Hope that helps
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Emilio
    Emilio avatar
    15 posts
    Member since:
    Mar 2012

    Posted 08 May 2012 Link to this post

    Hi,

    in my form load, there's no data yet in the grid, we noticed that if we populate the data on formload, there's no problem.

    Thanks
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 May 2012 Link to this post

    That's correct. When there is no data, and the grid is unbound, then the grid will be blank. 
    Please remember to mark as answer
    Thanks
    Richard
  6. Emilio
    Emilio avatar
    15 posts
    Member since:
    Mar 2012

    Posted 08 May 2012 Link to this post

    Hi Richard,

    The grid was bound, just so happen that the table was empty, the blank row is no problem, but the text "Click here to add new row" does not appear until we click the column header, is there a way we could show it if initially the table is empty.

    please see attached file .

    Thank you and best regards,
  7. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 May 2012 Link to this post

    Hello, 

    After setting your datasource, set the following

    C#
    this.radGridView1.CurrentRow = null;

    VB
    Me.RadGridView1.CurrentRow = Nothing

    Richard
  8. Emilio
    Emilio avatar
    15 posts
    Member since:
    Mar 2012

    Posted 08 May 2012 Link to this post

    Great help.

    Thanks. and more power.
Back to Top
UI for WinForms is Visual Studio 2017 Ready