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

RadInputManager error if field not visible

9 Answers 188 Views
Input
This is a migrated thread and some comments may be shown as answers.
EET Group
Top achievements
Rank 2
EET Group asked on 21 Jan 2009, 03:13 PM
I have the RadInputManager targeted on a RadGrid with TextField's. However I get an error if one of the TextField's has Visibility="False". This error comes if just one single field is hidden in a grid with 20 item rows.

The JavaScript error is:

_4f is null 

Which targets the following line in a ScriptResource.axd:

if((_4f.value)&&(_4f.value==this._owner.get_emptyMessage())){ 

I think it should be possible to hide fields, but please tell me if I'm missing something?


9 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 26 Jan 2009, 11:13 AM
Hello Buffer,

I'm afraid that I'm unable to recreate the behavior in question locally. Can you please provide more details about you scenario and implementation? Some code snippets will be appreciated.

Kind regards,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Henrik
Top achievements
Rank 1
answered on 06 Mar 2009, 02:18 PM
I have the exact same problem. To increase performance of the radgrid, I use a RadInputManager like this:
<tel:RadInputManager ID="InputManager" runat="server"
        <tel:NumericTextBoxSetting MinValue="0" MaxValue="100" SelectionOnFocus="SelectAll" DecimalDigits="2" Type="Percent"
            <TargetControls> 
                <tel:TargetInput ControlID="gridID" /> 
            </TargetControls> 
        </tel:NumericTextBoxSetting> 
    </tel:RadInputManager> 

And in the grid, I have som columns in the following form:
<tel:GridTemplateColumn HeaderText="..." UniqueName="Something"
                            <EditItemTemplate> 
                                <asp:TextBox ID="txtPropertyName" Text='<%# Bind("PropertyName") %>' runat="server" /> 
                            </EditItemTemplate> 
                            <ItemTemplate> 
                                  <%# DataBinder.Eval(Container.DataItem, "PropertyName")%> 
                            </ItemTemplate> 
                        </tel:GridTemplateColumn>  

However, sometimes I set the Visible property og the grid to false (within an AJAX request), which causes a JavaScript error like described by Buffer "_someid is null". I remove the RadInputmanger from the page, the error does not occur.

I hope this can help you find out what's wrong?

Best regards

Henrik


0
Henrik
Top achievements
Rank 1
answered on 09 Mar 2009, 10:15 AM
Hi again,
I am very interested in knowing whether you have been able to reproduce this error?
Buffer - maybe you found a solution  for this?
0
EET Group
Top achievements
Rank 2
answered on 09 Mar 2009, 10:19 AM
I have found no solution for this. My workaround became setting the fields to Enabled="false" instead. It wasn't a big problem for me that they are still visible - as long as they are disabled.

I still experience the error on general paging from time to time. I think I need to go through everything with a fine toothed comb and see if I am hiding anything else.

I hope some Telerik staff will drill into this, because it has really made me kindda sour on using the Telerik Grid. If there are so many problems with the Telerik AJAX, I might as well go back to a GridView and do the advanced things myself, where I at least can fix the stuff myself...
0
Rosen
Telerik team
answered on 09 Mar 2009, 04:39 PM
Hi,

I have attached a simple test webpage which tries to re-create the scenario in question. Can you please take a look maybe I'm missing something obvious.

Kind regards,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Henrik
Top achievements
Rank 1
answered on 11 Mar 2009, 01:06 PM
Hi Rosen,

Sorry, but for my part, the sample you provided is not very sufficient, because I load the grid with all rows in edit mode. I have a global save button in a radtoolbar that saves all the data with one click.

Besides the problem described above, I have now run into a new problem in a simliar grid. This grid is placed in a RadPageView (I don't know if it has something to say). This grid is also always in edit mode. It is declared like this:

<tel:Grid ID="gridLedninger" GridLines="None" 
AllowMultiRowEdit="true" AllowMultiRowSelection="true" AllowAutomaticUpdates="true" 
OnNeedDataSource="gridLedninger_NeedDataSource" OnItemDataBound="gridLedninger_ItemDataBound" OnPreRender="GridLedninger_PreRender" 
AllowPaging="false" AllowSorting="false" runat="server"
<MasterTableView DataKeyNames="Id" EditMode="InPlace" CommandItemDisplay="None" GridLines="None"
                <Columns> 
                    <tel:GridClientSelectColumn UniqueName="SelectColumn" HeaderTooltip="Markér alle"
              <HeaderStyle Width="20px" /> 
          </tel:GridClientSelectColumn> 
                    <tel:GridTemplateColumn DataField="DimensionFrom"
                        <HeaderTemplate> 
                            <table width="90"
                                <tr> 
                                    <td>Dim. &ge;</td> 
                                    <td align="right">[mm]</td> 
                                </tr> 
                            </table> 
                        </HeaderTemplate> 
                        <EditItemTemplate> 
                            <asp:TextBox ID="txtDimensionFra" Text='<%# Bind("DimensionFrom") %>' Width="50" runat="server" /> 
                        </EditItemTemplate> 
                    </tel:GridTemplateColumn> 
                     
tel:GridTemplateColumn HeaderText="Materiale" SortExpression="Materiale.Beskrivelse" ItemStyle-Width="170px"
                        <EditItemTemplate> 
                            <asp:DropDownList ID="ddMaterialer" DataTextField="Beskrivelse" DataValueField="Kode" Width="155" CssClass="select" runat="server" /> 
                        </EditItemTemplate> 
                    </tel:GridTemplateColumn> 
                     
                    <tel:GridTemplateColumn  SortExpression="Price"
                        <HeaderTemplate> 
                            <table width="90"
                                <tr> 
                                    <td>Pris - city</td> 
                                    <td align="right">[kr]</td> 
                                </tr> 
                            </table> 
                        </HeaderTemplate> 
                        <EditItemTemplate> 
                            <asp:TextBox ID="txtPrisCity" Text='<%# Bind("Price") %>' Width="70" runat="server" /> 
                        </EditItemTemplate> 
                    </tel:GridTemplateColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings > 
                <Selecting AllowRowSelect="True" /> 
      </ClientSettings> 
        </tel:Grid> 
I also have a radinputmanager delclared like this:

<tel:RadInputManager ID="InputManager" runat="server"
        <tel:NumericTextBoxSetting SelectionOnFocus="SelectAll" DecimalDigits="0" MinValue="0" HoveredCssClass="textbox numeric" EnabledCssClass="textbox numeric" FocusedCssClass="textbox numeric" DisabledCssClass="textbox numeric" Type="Number"
            <TargetControls> 
        <tel:TargetInput ControlID="gridLedninger" /> 
            </TargetControls> 
        </tel:NumericTextBoxSetting> 
    </tel:RadInputManager> 

When the page loads the first time, the textboxes is formatted like I expect.


In this page, I have a button placed in a radtoolbar, which ads a new row to the grid through an ajax call. All it does is to add an empty entiry to the list that the grid is bound to. But the textboxes in the newly inserted row are not formatted and styled like the rest of the textboxes that was loaded initially. It seems like the radinputmanager cannot "see" the controls in the newly added row.

I really hope, you can reproduce this error, because it is causing me a lot of problems. And the only reason I use the inputmanager is because of the bad performance when using RadNumericTextBox for each value.

But the problems does not end here, unfortunately. In the radtoolbar, I also have a button for removing selected rows through an ajax request. If I remove a row that was loaded initially and afterwards want to save the grid, the javascript error occurs:

_4f is null  

So, once again, I've run into the problem described initially in this thread.
Here are some more code from the page, that hopefully can help.
AjaxManagerProxy that wires the toolbar together with the grid:
<tel:RadAjaxManagerProxy ID="PageAjaxManger" runat="server"
        <AjaxSettings> 
            <tel:AjaxSetting AjaxControlID="tbButtons"
                <UpdatedControls> 
                    <tel:AjaxUpdatedControl ControlID="gridLedninger" LoadingPanelID="AjaxLoadingPanel" /> 
                </UpdatedControls> 
            </tel:AjaxSetting> 
            <tel:AjaxSetting AjaxControlID="gridLedninger"
                <UpdatedControls> 
                    <tel:AjaxUpdatedControl ControlID="gridLedninger" LoadingPanelID="AjaxLoadingPanel" /> 
                </UpdatedControls> 
            </tel:AjaxSetting> 
        </AjaxSettings> 
    </tel:RadAjaxManagerProxy> 

Codebehind:
protected void GridLedninger_PreRender(object sender, System.EventArgs e) 
        { 
foreach (GridItem item in gridLedninger.MasterTableView.Items) 
                { 
                    if (item is GridEditableItem) 
                    { 
                        GridEditableItem editableItem = item as GridDataItem; 
                        editableItem.Edit = true
                    } 
 
                } 
 
                gridLedninger.Rebind(); 
        } 



protected void gridLedninger_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    { 
            gridLedninger.DataSource = Ledninger; 
    } 
 
 
        protected void gridLedninger_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
            { 
                    GridEditableItem editItem = (GridEditableItem)e.Item; 
                    IEntity vaerdi = (IEntity)editItem.DataItem; 
 
                    DropDownList ddMaterialer = (DropDownList)editItem.FindControl("ddMaterialer"); 
                    ddMaterialer.DataSource = Materialer; 
                    ddMaterialer.SelectedValue = vaerdi.Materiale != null ? vaerdi.Materiale.Kode.ToString() : "0"
                    ddMaterialer.DataBind(); 
            } 
        } 

public IList<IEntity> Ledninger  
        { 
            get { return (IList<IEntity>)Session[skLedningStandardVaerdier]; } 
            set 
            { 
                gridLedninger.DataSource = Session[skLedningStandardVaerdier] = value; 
                gridLedninger.Rebind(); 
            }  
        } 
 
        public IList<IEntityOptions> Materialer  
        { 
            internal get { return (IList<IEntityOptions>)Session[skLedningsMaterialer]; } 
            set { Session[skLedningsMaterialer] = value; } 
        } 




Best regards
Henrik


0
Henrik
Top achievements
Rank 1
answered on 13 Mar 2009, 08:41 AM
It seems like I've found out what caused the "_4f is null" error. I tried to add the toolbar and the InputManager to the RadAjaxManagerProxy like this:
<tel:AjaxSetting AjaxControlID="tbButtons"
            <UpdatedControls> 
                <tel:AjaxUpdatedControl ControlID="InputManager" /> 
            </UpdatedControls> 
        </tel:AjaxSetting> 
After that, I'm not getting the mentioned error anymore after using the making ajax requests through the buttons in the toolbar. Can anyone tell we if it is the right approach to have the InputManager added like this when using AJAX?



0
Accepted
Rosen
Telerik team
answered on 13 Mar 2009, 10:03 AM
Hi Henrik,

Indeed you should set InputManager as an updated control this way the control state will be updated correctly.

Sincerely yours,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Henrik
Top achievements
Rank 1
answered on 24 Mar 2009, 01:56 PM
Hi Rosen,

Thank you the answer. This solves the problem for my part.
I'm sorry for the inconvenience.

Best regards

Henrik
Tags
Input
Asked by
EET Group
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Henrik
Top achievements
Rank 1
EET Group
Top achievements
Rank 2
Share this question
or