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

GridNumericColumnEditor and edit

7 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lnu
Top achievements
Rank 1
lnu asked on 26 Oct 2009, 04:51 PM
Hello,

I've got an RadGrid with inline edit mode. I put a GridNumericColumnEditor in the markup and associated it with a column(ColumnEditorID attribute) .
The first time I click "edit", the editor is applied to the column. If I click "cancel" and then click "edit" again, everything goes well.
But, if I try to "edit" a row while already have one in edit mode, the editor is not applied. If I put a watch on it, it's empty.

I put on the same page a "GridDateTimeColumnEditor" and everything works with this one.

here's my code

<telerik:GridNumericColumnEditor ID="quantityColumnEditor" runat="server"
        <NumericTextBox runat="server" ID="xxx" Width="50px" ShowSpinButtons="true" MaxValue="999" 
            MinValue="1"
            <IncrementSettings Step="1" /> 
        </NumericTextBox> 
    </telerik:GridNumericColumnEditor> 
    <telerik:GridDateTimeColumnEditor ID="deliveryDateColumnEditor" runat="server"
        <TextBoxStyle Width="92px" /> 
    </telerik:GridDateTimeColumnEditor> 

 <telerik:GridNumericColumn ColumnEditorID="quantityColumnEditor" FilterControlWidth="50px" 
                    ConvertEmptyStringToNull="true" HeaderText="QUANTITY" DataType="System.Int32" 
                    DataField="QUANTITY" UniqueName="quantity"
                    <HeaderStyle Width="80px" Wrap="false" CssClass="rgHeader xxFCcol6" /> 
</telerik:GridNumericColumn> 
 <telerik:GridDateTimeColumn ColumnEditorID="deliveryDateColumnEditor" HeaderText="DATE OF REQUEST" 
                    DataField="REQUESTDATE" DataType="System.Datetime" EmptyDataText="n/a" ConvertEmptyStringToNull="true" 
                    UniqueName="requestdate" DataFormatString="{0:d}"
                    <HeaderStyle Width="100px" CssClass="rgHeader xxFCcol3" /> 
</telerik:GridDateTimeColumn> 


Any Idea?

7 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 29 Oct 2009, 03:17 PM
Hello lnu,

Thank you for informing us about this issue. I will forward your report to our developers for further investigation. I hope they can find a quick resolution for it.

Please excuse us for the inconvenience.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
lnu
Top achievements
Rank 1
answered on 17 Nov 2009, 08:39 AM
Hi,

I have the same problem now with allowmultipleedit: the gridnumericcolumneditor is only applied to the first edited row and not the others.

best regards,

Laurent


0
Martin
Telerik team
answered on 20 Nov 2009, 07:39 AM
Hello lnu,

Currently the GridNumericColumnEditor does not support more than one items into edit / insert mode. As a workaround you can use RadGrid with modal Popup edit forms. The first RadGrid in this online demo demonstrates this approach. For more information about Popup edit forms please check:

Popup Edit Form

Another option to ensure that only one item could be in edit / insert mode at a time is to hide the relevant buttons of the other items. Here is one possible approach to achieve that:

bool isEdit;
    protected void Page_Load(object sender, EventArgs e)
    {
        isEdit = false;
    }
    
    protected void RadGrid1_ItemCommand1(object source, GridCommandEventArgs e)
    {
        if (e.CommandName == RadGrid.EditCommandName)
        {
            e.Item.OwnerTableView.IsItemInserted = false;
            isEdit = true;
        }
    }
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (isEdit || RadGrid1.MasterTableView.IsItemInserted)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem item = e.Item as GridDataItem;
                if (item["AutoGeneratedEditColumn"] != null)
                {
                    item["AutoGeneratedEditColumn"].Controls[0].Visible = e.Item.IsInEditMode;
                }
 
                if (item["MyGridEditCommandColumnUniqueName"] != null)
                {
                    item["MyGridEditCommandColumnUniqueName"].Controls[0].Visible = e.Item.IsInEditMode;
                }
            }
            if (e.Item is GridCommandItem)
            {
                GridCommandItem commandItem = e.Item as GridCommandItem;
                Control commandItemPane = commandItem.Controls[0];
                if (commandItemPane != null)
                {
                    commandItemPane.Visible = false;
                }
            }
        }
    }

I hope this helps.

Regards,
Martin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Russell
Top achievements
Rank 1
answered on 20 May 2010, 10:23 PM
I just spend the day fighting the GridNumericColumnEditor changing size on the second click.  I saw this post and changed it to a GridTextBoxColumnEditor and it works fine, but now my format strings do not work for the numbers when they are in edit mode.  Is the GridNumericColumnEditor going to get fixed?
0
Martin
Telerik team
answered on 26 May 2010, 11:33 AM
Hello Russell,

Unfortunately the GridNumericColumnEditor does not support more than one items into edit / insert mode. This is a limitation of the control and my suggestion is to use one of the workarounds provided in my previous post.

Thank you for your understanding and please excuse us for the inconvenience.

Kind regards,
Martin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Russell
Top achievements
Rank 1
answered on 26 May 2010, 03:42 PM
There is not more than one row in edit mode.  The first time you put a row in edit mode it works fine.  Then when you put a second row into edit mode causing the first one to no longer be in edit mode that is when the problem occurs.  This has to be an error because the GridTextBoxColumnEditor works just fine.
0
Martin
Telerik team
answered on 28 May 2010, 03:59 PM
Hello Russell,

Please note that although you see only 1 item in edit mode this does not mean that only 1 item is in edit mode on the server all the time. The limitation of the numeric editor happens when there is an item in edit mode and a second one is forced to be edited before the previous one is set to view mode. This is exactly what happens when you click the edit link of another item- it puts the new item into edit mode and just after that closes any other edited items.

The workaround you can currently use is to ensure that you close any edited items before a new item is put into edit mode. Here are the options to achieve that:

  • Close edited items using their Update / Insert / Cancel buttons.
  • Use RadGrid with modal Popup edit forms.
  • Ensure that only one item could be in edit / insert mode at a time by hiding the relevant buttons of the other items.

For more information about the last two options, please review my second post in this forum thread.

I hope this helps,
Martin
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
lnu
Top achievements
Rank 1
Answers by
Martin
Telerik team
lnu
Top achievements
Rank 1
Russell
Top achievements
Rank 1
Share this question
or