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

RadUpdatePanel with radgrid not refreshing on insert

1 Answer 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fijula
Top achievements
Rank 1
fijula asked on 29 Jul 2011, 03:54 PM
I have a radgrid with a popup to insert record and when I try inserting record(from entity) from my serverside , I can see that the grid has the value but the updatepanel would not refresh unless I hit the refresh button on grid. Is there any way I can force the radupdatepanel to refresh from serverside?
Please see the code below
<table id="NotesAndCommentsTable" border="1" style="border-collapse:collapse;border-color:Black;display:block;background-color:White" 
                            width="100%" cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                 <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1" EnableAJAX="true">
                                 <telerik:RadGrid ID="grdNotes" runat="server" Skin="WebBlue"  CssClass="RadGrid" GridLines="None"
                                    AllowPaging="True" PageSize="20" AllowSorting="True" AutoGenerateColumns="False"
                                    ShowStatusBar="true" HorizontalAlign="NotSet" OnNeedDataSource="grdNotes_NeedDataSource" OnInsertCommand="grdNotes_InsertCommand">
                                        <MasterTableView CommandItemDisplay="Bottom" DataKeyNames="ClaimUserNotes_IDX" EditMode="PopUp">
                                         <Columns>
                                               <telerik:GridBoundColumn UniqueName="DateCreated" HeaderText="Date" DataField="DateCreated">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="UserCreated" HeaderText="User" DataField="UserCreated">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="Notes" HeaderText="Notes/Comments" DataField="Notes">
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                        <EditFormSettings CaptionFormatString="Edit :"
                                            CaptionDataField="Claim_Idx" EditFormType="Template" >
                                            <FormTemplate>
                                                <table id="Table1"  style="border-collapse:collapse;border-color:Black;display:block;background-color:White" cellspacing="1" cellpadding="1" width="100%" border="0">
                                                    <tr>
                                                        <td>
                                                        </td>
                                                        <td>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            Notes/Comments:
                                                        </td>
                                                        <td>
                                                            <asp:TextBox ID="TextBox10" TextMode="MultiLine" width="300" Text='<%# Bind( "Notes") %>' runat="server">
                                                            </asp:TextBox>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <table style="width: 100%;border-collapse:collapse;border-color:Black;display:block;background-color:White" >
                                                    <tr>
                                                        <td align="right" colspan="2">
                                                            <asp:Button ID="Button1" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
                                                                runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                                            </asp:Button
                                                            <asp:Button ID="Button2" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel">
                                                            </asp:Button>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </FormTemplate>
                                        </EditFormSettings>
                                    </MasterTableView>
                                    <ClientSettings>
                                        <ClientEvents OnRowDblClick="RowDblClick" />
                                    </ClientSettings>
                                </telerik:RadGrid>
                            </telerik:RadAjaxPanel>
                                <telerik:RadWindowManager ID="RadWindowManager1" runat="server" />
                                 </td>
                            </tr>
                        </table>
  and the .cs

 

 

protected void grdNotes_InsertCommand(object sender, GridCommandEventArgs e)

 

{

 

 

GridEditableItem dataItem = e.Item as GridEditableItem;

 

 

 

Hashtable values = new Hashtable();

 

dataItem.ExtractValues(values);

 

 

ClaimUserNotes un = new ClaimUserNotes();

 

un.Claim_IDX = claimId;

un.Notes = values[

 

"Notes"].ToString();

 

un.UserCreated = user.UserName;

un.DateCreated =

 

DateTime.Now;

 

entities.AddToClaimUserNotes(un);

entities.SaveChanges();

lstUserNotes = entities.ClaimUserNotes.Where(obj => obj.Claim_IDX == claimId).ToList();

 

grdNotes.Rebind();

}

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 04 Aug 2011, 09:25 AM
Hello Fijula,

I tried to reproduce the described issue, but to no avail. I am sending you a simple example, based on your code. Please check it out and let me know what differs in your case.

Looking forward for your reply.

Kind regards,
Radoslav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
fijula
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or