RadInputManager error if field not visible

10 posts, 1 answers
  1. EET Group
    EET Group avatar
    28 posts
    Member since:
    Aug 2007

    Posted 21 Jan 2009 Link to this post

    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?


  2. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 26 Jan 2009 Link to this post

    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.
  3. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 06 Mar 2009 Link to this post

    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


  4. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 09 Mar 2009 Link to this post

    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?
  5. EET Group
    EET Group avatar
    28 posts
    Member since:
    Aug 2007

    Posted 09 Mar 2009 Link to this post

    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...
  6. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 09 Mar 2009 Link to this post

    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.
  7. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 11 Mar 2009 Link to this post

    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:

    1 <tel:Grid ID="gridLedninger" GridLines="None" 
    2 AllowMultiRowEdit="true" AllowMultiRowSelection="true" AllowAutomaticUpdates="true" 
    3 OnNeedDataSource="gridLedninger_NeedDataSource" OnItemDataBound="gridLedninger_ItemDataBound" OnPreRender="GridLedninger_PreRender" 
    4 AllowPaging="false" AllowSorting="false" runat="server"
    5 <MasterTableView DataKeyNames="Id" EditMode="InPlace" CommandItemDisplay="None" GridLines="None"
    6                 <Columns> 
    7                     <tel:GridClientSelectColumn UniqueName="SelectColumn" HeaderTooltip="Markér alle"
    8               <HeaderStyle Width="20px" /> 
    9           </tel:GridClientSelectColumn> 
    10                     <tel:GridTemplateColumn DataField="DimensionFrom"
    11                         <HeaderTemplate> 
    12                             <table width="90"
    13                                 <tr> 
    14                                     <td>Dim. &ge;</td> 
    15                                     <td align="right">[mm]</td> 
    16                                 </tr> 
    17                             </table> 
    18                         </HeaderTemplate> 
    19                         <EditItemTemplate> 
    20                             <asp:TextBox ID="txtDimensionFra" Text='<%# Bind("DimensionFrom") %>' Width="50" runat="server" /> 
    21                         </EditItemTemplate> 
    22                     </tel:GridTemplateColumn> 
    23                      
    24 tel:GridTemplateColumn HeaderText="Materiale" SortExpression="Materiale.Beskrivelse" ItemStyle-Width="170px"
    25                         <EditItemTemplate> 
    26                             <asp:DropDownList ID="ddMaterialer" DataTextField="Beskrivelse" DataValueField="Kode" Width="155" CssClass="select" runat="server" /> 
    27                         </EditItemTemplate> 
    28                     </tel:GridTemplateColumn> 
    29                      
    30                     <tel:GridTemplateColumn  SortExpression="Price"
    31                         <HeaderTemplate> 
    32                             <table width="90"
    33                                 <tr> 
    34                                     <td>Pris - city</td> 
    35                                     <td align="right">[kr]</td> 
    36                                 </tr> 
    37                             </table> 
    38                         </HeaderTemplate> 
    39                         <EditItemTemplate> 
    40                             <asp:TextBox ID="txtPrisCity" Text='<%# Bind("Price") %>' Width="70" runat="server" /> 
    41                         </EditItemTemplate> 
    42                     </tel:GridTemplateColumn> 
    43                 </Columns> 
    44             </MasterTableView> 
    45             <ClientSettings > 
    46                 <Selecting AllowRowSelect="True" /> 
    47       </ClientSettings> 
    48         </tel:Grid> 
    I also have a radinputmanager delclared like this:

    1 <tel:RadInputManager ID="InputManager" runat="server"
    2         <tel:NumericTextBoxSetting SelectionOnFocus="SelectAll" DecimalDigits="0" MinValue="0" HoveredCssClass="textbox numeric" EnabledCssClass="textbox numeric" FocusedCssClass="textbox numeric" DisabledCssClass="textbox numeric" Type="Number"
    3             <TargetControls> 
    4         <tel:TargetInput ControlID="gridLedninger" /> 
    5             </TargetControls> 
    6         </tel:NumericTextBoxSetting> 
    7     </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:

    1 _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:
    1 <tel:RadAjaxManagerProxy ID="PageAjaxManger" runat="server"
    2         <AjaxSettings> 
    3             <tel:AjaxSetting AjaxControlID="tbButtons"
    4                 <UpdatedControls> 
    5                     <tel:AjaxUpdatedControl ControlID="gridLedninger" LoadingPanelID="AjaxLoadingPanel" /> 
    6                 </UpdatedControls> 
    7             </tel:AjaxSetting> 
    8             <tel:AjaxSetting AjaxControlID="gridLedninger"
    9                 <UpdatedControls> 
    10                     <tel:AjaxUpdatedControl ControlID="gridLedninger" LoadingPanelID="AjaxLoadingPanel" /> 
    11                 </UpdatedControls> 
    12             </tel:AjaxSetting> 
    13         </AjaxSettings> 
    14     </tel:RadAjaxManagerProxy> 

    Codebehind:
    1 protected void GridLedninger_PreRender(object sender, System.EventArgs e) 
    2         { 
    3 foreach (GridItem item in gridLedninger.MasterTableView.Items) 
    4                 { 
    5                     if (item is GridEditableItem) 
    6                     { 
    7                         GridEditableItem editableItem = item as GridDataItem; 
    8                         editableItem.Edit = true
    9                     } 
    10  
    11                 } 
    12  
    13                 gridLedninger.Rebind(); 
    14         } 



    1 protected void gridLedninger_NeedDataSource(object source, GridNeedDataSourceEventArgs e) 
    2     { 
    3             gridLedninger.DataSource = Ledninger; 
    4     } 
    5  
    6  
    7         protected void gridLedninger_ItemDataBound(object sender, GridItemEventArgs e) 
    8         { 
    9             if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
    10             { 
    11                     GridEditableItem editItem = (GridEditableItem)e.Item; 
    12                     IEntity vaerdi = (IEntity)editItem.DataItem; 
    13  
    14                     DropDownList ddMaterialer = (DropDownList)editItem.FindControl("ddMaterialer"); 
    15                     ddMaterialer.DataSource = Materialer; 
    16                     ddMaterialer.SelectedValue = vaerdi.Materiale != null ? vaerdi.Materiale.Kode.ToString() : "0"
    17                     ddMaterialer.DataBind(); 
    22             } 
    23         } 

    1 public IList<IEntity> Ledninger  
    2         { 
    3             get { return (IList<IEntity>)Session[skLedningStandardVaerdier]; } 
    4             set 
    5             { 
    6                 gridLedninger.DataSource = Session[skLedningStandardVaerdier] = value; 
    7                 gridLedninger.Rebind(); 
    8             }  
    9         } 
    10  
    11         public IList<IEntityOptions> Materialer  
    12         { 
    13             internal get { return (IList<IEntityOptions>)Session[skLedningsMaterialer]; } 
    14             set { Session[skLedningsMaterialer] = value; } 
    15         } 




    Best regards
    Henrik


  8. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 13 Mar 2009 Link to this post

    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:
    1 <tel:AjaxSetting AjaxControlID="tbButtons"
    2             <UpdatedControls> 
    3                 <tel:AjaxUpdatedControl ControlID="InputManager" /> 
    4             </UpdatedControls> 
    5         </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?



  9. Answer
    Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 13 Mar 2009 Link to this post

    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.
  10. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 24 Mar 2009 Link to this post

    Hi Rosen,

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

    Best regards

    Henrik
Back to Top