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

Update control inside raddataform with ajax

1 Answer 200 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
GD
Top achievements
Rank 1
GD asked on 28 Mar 2018, 07:45 PM

Hi,

I have a problem with this scenario. I need to update a radcombox after a postback of another radcombox inside a raddataform. But it doesn't work. An example is something like that:

 

<telerik:RadAjaxManager ID="radAjaxManager" runat="server" OnAjaxSettingCreating="radAjaxManager_AjaxSettingCreating">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="cmb1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="cmb2" LoadingPanelID="radAjaxLoadingPanel"/>
                      </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

        <telerik:RadAjaxLoadingPanel ID="radAjaxLoadingPanel" Runat="server" IsSticky="false" />

<telerik:RadDataForm runat="server" ID="radDataForm">
            <LayoutTemplate>
                <div id="itemPlaceholder" runat="server">
                </div>
            </LayoutTemplate>
            
            <InsertItemTemplate>

<telerik:RadPageLayout ID="radPageLayout" runat="server" GridType="Fluid" ShowGrid="true" HtmlTag="None">
                    <telerik:LayoutRow RowType="Container">
                        <Columns>
                            <telerik:LayoutColumn Span="3" HiddenMd="true" HiddenSm="true" HiddenXs="true">
                            
                            </telerik:LayoutColumn> 

                            <telerik:CompositeLayoutColumn Span="6" SpanMd="12" SpanXs="12" SpanSm="12">
                                <Content>
                                    <telerik:RadTabStrip ID="radTabStrip" runat="server" MultiPageID="radMultiPage" Align="Justify" 
                                                         ReorderTabsOnSelect="false" ScrollChildren="true" ScrollButtonsPosition="Middle" PerTabScrolling="true">
                                        <Tabs>
                                            <telerik:RadTab Text="Tab1" PageViewID="pg1" Selected="true" />
                                            <telerik:RadTab Text="Tab2" PageViewID="pg2" />
                                           
                                        </Tabs>
                                    </telerik:RadTabStrip>
                                
                                    <telerik:RadMultiPage ID="radMultiPage" runat="server" SelectedIndex="0">
                                        <telerik:RadPageView ID="pg1" runat="server">
                                            <telerik:RadPageLayout ID="radPageLayoutGenerici" runat="server" GridType="Fluid" ShowGrid="true" HtmlTag="None">
                                                <Rows>
                                                    <telerik:LayoutRow RowType="Container">

                                                           <Content>
                                                            <telerik:RadComboBox ID="cmb1" runat="server"  AutoPostBack="true">
                                                                <DefaultItem Text="" Value="" />
                                                            </telerik:RadComboBox>
                                                           
                                                        </Content>
                                                    </telerik:LayoutRow>  
                                                    <telerik:LayoutRow RowType="Container">
                                                        <Content>
                                                            <telerik:RadComboBox ID="cmb2" runat="server"  DataTextField="Descrizione">
                                                                <DefaultItem Text="" Value="" />
                                                            </telerik:RadComboBox>
                                                        </Content>
                                                    </telerik:LayoutRow>  
                                                </Rows>
                                            </telerik:RadPageLayout>
                                            
                                        </telerik:RadPageView>

                                        <telerik:RadPageView ID="pg2" runat="server">

                                        </telerik:RadPageView>
                                
                                    </telerik:RadMultiPage>

                                   
                                </Content>      
                            </telerik:CompositeLayoutColumn>

                            <telerik:LayoutColumn Span="3" HiddenMd="true" HiddenSm="true" HiddenXs="true">
                                
                            </telerik:LayoutColumn> 

                        
                        </Columns>
                    </telerik:LayoutRow>    
                </telerik:RadPageLayout>
            </InsertItemTemplate>


I Just semplify my code only for example. Someone can help me?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Apr 2018, 07:37 AM
Hi,

Controls inside templates and repeated controls cannot be added directly to the AjaxSettings because there is no way for the RadAjaxManager to know how to access them in order to wrap them in UpdatePanel controls. Another prime example of such a scenario are controls in a TempateColumn in a RadGrid.

The solution to such a case is to add the data bound container control to the AjaxSettings collection. So, instead of the combo boxes, you will AJAX-enable the data form:

<telerik:AjaxSetting AjaxControlID="radDataForm">
    <UpdatedControls>
        <telerik:AjaxUpdatedControl ControlID="radDataForm" LoadingPanelID="radAjaxLoadingPanel"/>
      </UpdatedControls>
</telerik:AjaxSetting>

Another solution is to use things like client-side binding and the client-side events of controls/HTML elements to create the desired logic, instead of postbacks. The exact way to do that would vary between each scenario, however, so there is no general guidance for doing that.


Regards,
Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Ajax
Asked by
GD
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or