This is a migrated thread and some comments may be shown as answers.

Missing text: Click here to add new row in 2010 Q3

8 Answers 142 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 15 Nov 2010, 11:46 AM

Hi

In 2010 Q2 SP2 in row for adding new rows there was text: Click here to add new row (or very similar). This text is missing in Q3 by default. How can I display this text in Q3 (in row for adding new rows)?

Reagrds

8 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 15 Nov 2010, 12:19 PM
Hello Raymond,

This should provide you with some text to show that they are cells to add new data. You'll need to register the ViewCellFormatting event

private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.RowElement is GridNewRowElement)
    {
        e.CellElement.RowElement.TextAlignment = ContentAlignment.MiddleCenter;
        if (e.CellElement is GridDataCellElement)
        {
            e.CellElement.Text = "Add Data";
            e.CellElement.Visibility = Telerik.WinControls.ElementVisibility.Visible;  
        }
    
}

hope that helps
Richard
0
Raymond
Top achievements
Rank 1
answered on 15 Nov 2010, 03:27 PM

No it doesn`t solve my problem.

In Q2 SP2 I could get result as in attached image.

I Q2 SP2 there is bug that if there are no real rows in grid this text doesn`t appear, so I handled this programmatically:

(related thread from Q2 SP2: http://www.telerik.com/community/forums/winforms/gridview/three-problems-with-adding-new-row.aspx )

 

private void radGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e)
{
    if (e.RowElement is GridNewRowElement)
    {
        adding text click here to add new row, problem is only if there are no real rows in grid
        if (radGridView1.Rows.Count == 0)
        {
            if ((e.RowElement.RowVisualState == GridRowElement.RowVisualStates.Current) &&
                (e.RowElement.RowInfo.Cells[0].Value == null) && (e.RowElement.RowInfo.Cells[1].Value == null) && (e.RowElement.RowInfo.Cells[2].Value == null))
            {
                e.RowElement.Text = RadGridLocalizationProvider.CurrentProvider.GetLocalizedString(RadGridStringId.AddNewRowString);
            }
            else
            {
                if (!string.IsNullOrEmpty(e.RowElement.Text))
                { e.RowElement.Text = string.Empty; }
            }
        }               
    }
}

 

 

If there is at least one real row and row for adding new rows doesn`t have focus this text appears by deafult (in Q2 SP2).

 I cannot get the same result in Q3.

Regards

0
Richard Slade
Top achievements
Rank 2
answered on 15 Nov 2010, 03:54 PM
Hello,

it looks as though this has been removed to me in the Q3 release. None of the demos I have seen so far have the "Click here to add new row" text, and setting a RadGridLocalizationProvider for AddNewRowString no longer produces a result.

I'll look further however and see if I can come up with something
Richard
0
Raymond
Top achievements
Rank 1
answered on 15 Nov 2010, 04:01 PM

I am looking forward on message from you because I showed this text my clients and they liked it and with Q3 I cannot display this text in the same manner.

0
Richard Slade
Top achievements
Rank 2
answered on 16 Nov 2010, 08:34 AM
Hello Raymond,

At the moment, I haven't got a workaround for this for you. I'll continue to look as and when I can to see if I can.
Regards,
Richard
0
Jack
Telerik team
answered on 17 Nov 2010, 05:33 PM
Hi Raymond,

We have not removed the "Click here to add new row"  text intentionally. However, this is an issue which we introduced in our latest release. It will be addressed in our upcoming service pack. This is a critical issue for us and that is why we plan to release an internal build which will be available later this week. 

I hope this helps. If you have any further questions, do not hesitate to contact us.

Kind regards,
Jack
the Telerik team
See What's New in RadControls for WinForms in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
0
Emanuel Varga
Top achievements
Rank 1
answered on 18 Jan 2011, 09:37 AM
Hello guys,

There is another problem in the latest Q3 SP1 release regarding the Click here to add new row text, if you use the CurrentRowChanging event and cancel the change if it's the new row, then the click here... text will not be visible anymore.

A workaround for this:
void radGridView1_CurrentRowChanging(object sender, CurrentRowChangingEventArgs e)
{
    if (e.Cancel = e.NewRow is GridViewNewRowInfo)
    {
        var newRowElement = radGridView1.TableElement.VisualRows.Where(r => r.RowInfo == e.NewRow).FirstOrDefault();
        if (newRowElement != null)
        {
            newRowElement.Text = RadGridLocalizationProvider.CreateDefaultLocalizationProvider().GetLocalizedString(RadGridStringId.AddNewRowString);
        }
    }
}

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Jack
Telerik team
answered on 20 Jan 2011, 02:21 PM
Hi Emanuel,

Thank you for reporting this issue. I was able to reproduce it with the latest version - Q3 2010 SP1 and added the issue to our issue tracking system. It will be addressed in one of the upcoming releases.

Regards,
Jack
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
Tags
GridView
Asked by
Raymond
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Raymond
Top achievements
Rank 1
Jack
Telerik team
Emanuel Varga
Top achievements
Rank 1
Share this question
or