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

[Solved] Grid in updatepanel causes full postback first time...then works fine

6 Answers 253 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
swegele
Top achievements
Rank 1
swegele asked on 21 Jul 2009, 09:45 PM
My radGrid is placed inside an RadAjaxUpdatePanel which points to the LoadingPanel.  When the page loads and I click an edit button on the grid (add/delete/edit) the whole page refreshes with a full post back.  But subsequent clicks on grid edit buttons cause Ajax behavior as expected.  What is causing this first full postback?

The grid/updatepanel is inside a formview control which is inside a wizard step.  The Formview is set to default to editmode and I only have the FormView.EditItemTemplate configured.

Thanks

Sean

asp below

<asp:Wizard ID="InvestigatorWiz" runat="server" ActiveStepIndex="0" Height="100%" 
        Width="100%" BackColor="Beige" BorderColor="Brown" BorderStyle="Solid" BorderWidth="1px" 
        Font-Names="Verdana" Font-Size="X-Small" DisplaySideBar="False" HeaderText="Investigator Summary" 
        NavigationButtonStyle-CssClass="button" FinishDestinationPageUrl="View_Company.aspx" 
        CancelDestinationPageUrl="View_Company.aspx" OnNextButtonClick="InvestigatorWiz_NextButtonClick"
        <WizardSteps> 
            <asp:WizardStep ID="EditInvestigator" runat="server" StepType="Start" Title="Investigator"
                <asp:FormView ID="MVInvestigator" DataKeyNames="InvestigatorID" runat="server" DataSourceID="CslaDataSourceInvestigator" 
                    DefaultMode="Edit" OnItemUpdated="MVInvestigator_ItemUpdated" OnItemUpdating="MVInvestigator_ItemUpdating"
                    <EditItemTemplate> 
                        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" /> 
                        <table style="vertical-align: top; font: 10pt verdana; width: 100%;" bordercolor="brown"
                            <tr> 
                                <td colspan="2" style="height: 10px; width: 100%; border-bottom: tan thin solid; 
                                    font-weight: bold;"> 
                                    <h5> 
                                        <font color="black">Enter Investigator Information:</font></h5
                                    <h6> 
                                        <font color="black"><b>Please enter the Investigator name (First, Middle, and Last) 
                                            and credentials as you wish it to appear on all approval documents. (For example 
                                            - Dave S. Smith M.D., PhD, F.A.C.C or Sally Sue Smith M.D., MBA). </b></font
                                    </h6> 
                                    <br /> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td colspan="2"
                                    Medical Licenses: 
                                </td> 
                            </tr> 
                            <tr> 
                                <td colspan="2"
                                    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="250px" Width="100%" LoadingPanelID="RadAjaxLoadingPanel2"
                                        <telerik:RadGrid ID="RadGrid1" runat="server" AllowSorting="True" OnItemUpdated="RadGrid1_ItemUpdated" 
                                            OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" AllowAutomaticDeletes="True" 
                                            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="CslaDataSourceInvestigatorMEDLicense" 
                                            GridLines="None" Width="100%"
                                            <MasterTableView AutoGenerateColumns="False" DataKeyNames="InvestigatorMEDLicenseID" 
                                                DataSourceID="CslaDataSourceInvestigatorMEDLicense" EditMode="InPlace" CommandItemDisplay="Bottom" 
                                                InsertItemDisplay="Bottom" CommandItemSettings-AddNewRecordText="Add new license"
                                                <RowIndicatorColumn> 
                                                    <HeaderStyle Width="20px" /> 
                                                </RowIndicatorColumn> 
                                                <ExpandCollapseColumn> 
                                                    <HeaderStyle Width="20px" /> 
                                                </ExpandCollapseColumn> 
                                                <Columns> 
                                                    <telerik:GridTemplateColumn HeaderText="State" SortExpression="MEDLicenseState" UniqueName="MEDLicenseState"
                                                        <ItemTemplate> 
                                                            <asp:Label runat="server" ID="lblUnitPrice" Text='<%# Bind("MEDLicenseState") %>'></asp:Label> 
                                                        </ItemTemplate> 
                                                        <EditItemTemplate> 
                                                            <telerik:RadComboBox ID="cboState" runat="server" DataSourceID="XmlStates1" DataTextField="name" 
                                                                DataValueField="abbreviation" SelectedValue='<%# Bind("MEDLicenseState") %>'
                                                            </telerik:RadComboBox> 
                                                            <br /> 
                                                            <asp:RequiredFieldValidator InitialValue="Enter a State" ID="RequiredFieldValidator1" 
                                                                ControlToValidate="cboState" ErrorMessage="This field is required" runat="server"
                                                            </asp:RequiredFieldValidator> 
                                                        </EditItemTemplate> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridTemplateColumn HeaderText="License #" SortExpression="MEDLicenseNumber" 
                                                        UniqueName="MEDLicenseNumber"
                                                        <ItemTemplate> 
                                                            <asp:Label runat="server" ID="lblMEDLicenseNumber" Text='<%# Bind("MEDLicenseNumber") %>'></asp:Label> 
                                                        </ItemTemplate> 
                                                        <EditItemTemplate> 
                                                            <telerik:RadTextBox ID="txtMEDLicenseNumber" runat="server" EmptyMessage="Enter License #" 
                                                                Text='<%# Bind("MEDLicenseNumber") %>'
                                                            </telerik:RadTextBox><br /> 
                                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="txtMEDLicenseNumber" 
                                                                ErrorMessage="This field is required" runat="server"
                                                            </asp:RequiredFieldValidator> 
                                                        </EditItemTemplate> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridTemplateColumn HeaderText="Expires" SortExpression="MEDLicenseEXPDate" 
                                                        UniqueName="MEDLicenseEXPDate"
                                                        <ItemTemplate> 
                                                            <asp:Label runat="server" ID="lblMEDLicenseEXPDate" Text='<%# Bind("MEDLicenseEXPDate") %>'></asp:Label> 
                                                        </ItemTemplate> 
                                                        <EditItemTemplate> 
                                                            <telerik:RadDatePicker AllowEmpty="true" ShowPopupOnFocus="true" DateInput-EmptyMessage="Enter an expiration date" 
                                                                Calendar-RangeMinDate="<%# System.DateTime.Today %>" ID="txtMEDLicenseEXPDate" 
                                                                runat="server" DbSelectedDate='<%# Bind("MEDLicenseEXPDate") %>'
                                                            </telerik:RadDatePicker> 
                                                            <br /> 
                                                            <asp:RequiredFieldValidator ControlToValidate="txtMEDLicenseEXPDate" ID="RequiredFieldValidator3" 
                                                                runat="server" ErrorMessage="This field is required"></asp:RequiredFieldValidator> 
                                                        </EditItemTemplate> 
                                                    </telerik:GridTemplateColumn> 
                                                    <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"
                                                    </telerik:GridEditCommandColumn> 
                                                    <telerik:GridButtonColumn ConfirmText="Delete this license?" ConfirmDialogType="RadWindow" 
                                                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" 
                                                        UniqueName="DeleteColumn"
                                                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> 
                                                    </telerik:GridButtonColumn> 
                                                </Columns> 
                                            </MasterTableView> 
                                            <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True"
                                                <Selecting AllowRowSelect="True" /> 
                                            </ClientSettings> 
                                        </telerik:RadGrid> 
                                     
                                    </telerik:RadAjaxPanel> 
                                </td> 
                            </tr> 
                        </table> 
                    </EditItemTemplate> 
                </asp:FormView> 
            </asp:WizardStep> 
        </WizardSteps> 
        <StepStyle BorderWidth="0px" ForeColor="#5D7B9D" /> 
        <SideBarStyle BackColor="#7C6F57" BorderWidth="0px" Font-Size="0.9em" VerticalAlign="Top" /> 
        <NavigationButtonStyle CssClass="button" BackColor="#FFFBFF" BorderColor="#CCCCCC" 
            BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" 
            ForeColor="#284775" Width="0px" /> 
        <SideBarButtonStyle BorderWidth="0px" Font-Names="Verdana" ForeColor="White" /> 
        <HeaderStyle BackColor="Tan" BorderStyle="Solid" Font-Bold="True" Font-Size="Small" 
            ForeColor="White" HorizontalAlign="Center" BorderWidth="1px" VerticalAlign="Middle" /> 
    </asp:Wizard> 

6 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Jul 2009, 02:44 PM
Hello Sean,

Could you please try to move your RadAjaxPanel (together with the LoadingPanel) to wrap the Wizard?
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Vista" /> 
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="250px" Width="100%" 
    LoadingPanelID="RadAjaxLoadingPanel2"
    <asp:Wizard ID="InvestigatorWiz" runat="server" ActiveStepIndex="0" Height="100%" 
        Width="100%" BackColor="Beige" BorderColor="Brown" BorderStyle="Solid" BorderWidth="1px" 
        Font-Names="Verdana" Font-Size="X-Small" DisplaySideBar="False" HeaderText="Investigator Summary" 
        NavigationButtonStyle-CssClass="button" FinishDestinationPageUrl="View_Company.aspx" 
        CancelDestinationPageUrl="View_Company.aspx">
            ...

I hope this helps.

Kind regards,
Daniel
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
Jeroen de Roos
Top achievements
Rank 1
answered on 27 Oct 2009, 03:44 PM
Have you ever found a solution? I'm having the same problem with radtab's: first time full postback, subsequent times partial updates as it should.

0
Sean
Top achievements
Rank 1
answered on 27 Oct 2009, 07:01 PM
I was so frustrated that I threw out ajax on that page.  I never did try the suggestion of using the panel around the whole thing instead of the manager.

Did you try it?

Sean
0
Jeroen de Roos
Top achievements
Rank 1
answered on 28 Oct 2009, 07:54 AM
I already had all the stuff in one panel. Gonna see if here's something that works for me:
http://www.telerik.com/community/forums/aspnet-ajax/ajax/radajaxpanel-cauing-full-postback-1st-time.aspx

0
Daniel
Telerik team
answered on 02 Nov 2009, 02:43 PM
Hello Jeroen de Roos,

Could you please submit a stripped runnable project that highlights the problem? I would like to debug/examine it on my end.

Best regards,
Daniel
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
Jeroen de Roos
Top achievements
Rank 1
answered on 03 Nov 2009, 07:38 AM

Daniel, thanks for your offer, but at the moment I do not have the time to prepare a stripped example for you. For the time being I hope that my customer doesn't find it a (big) problem. If he/she does I will get back to you. Thanks again.
Tags
Ajax
Asked by
swegele
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Jeroen de Roos
Top achievements
Rank 1
Sean
Top achievements
Rank 1
Share this question
or