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

Refreshing Grid From Nested UserControl

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 29 Apr 2009, 10:16 PM
I thought this would be easier than it has become, but I am stuck trying to refresh my grid when a change is make from a FormView (that is in a UserControl) from the forms NestedView.  Basically I am doing a simple update, but that data that is getting update is part of the main grids display so I want the grid to rebind or refresh when the change is made.

Here is how my grid is set up:
<NestedViewTemplate> 
       <uc1:AppViewer ID="AppViewer1" runat="server" /> 
    </NestedViewTemplate> 

Then from a <asp:FormView> inside that usercontrol 'AppViewer1' I have:
<telerik:RadComboBox ID="list_appState" Runat="server" Skin="Sunset" SelectedValue='<%# Bind("app_state") %>' AutoPostBack="True" OnSelectedIndexChanged="list_appState_SelectedIndexChanged"

And finally from the user control code behind:
Protected Sub list_appState_SelectedIndexChanged(ByVal o As ObjectByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) 
 
        Dim record As Integer = (TryCast(Parent.FindControl("GridRec"), Label)).Text 
        Dim AppState As String = (TryCast(formview_AppInfo.FindControl("list_appState"), RadComboBox)).SelectedValue 
 
        Dim UpdateSuccess As Integer = Applications.UpdateAppState(record, AppState) 
 
        If UpdateSuccess > 0 Then 
            lbl_status.Text = String.Format("<br />The Application Status has been updated to '{0}' for record: {1}.<br /><br />", AppState, record) 
            'Dim grid As RadGrid = Parent.FindControl("grid_applications") 
            'grid.Rebind() 
        End If 
 
    End Sub 

Any ideas on an easier way to do this?  Appreciate it.


1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 05 May 2009, 08:22 AM
Hello Shawn,

Rebinding the grid control is the proper way to ensure that its contents are refreshed and contain the most recent and relevant data. There is no other straightforward way to accomplish this. I hope the present approach handles the setup well.

Kind regards,
Yavor
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.
Tags
Grid
Asked by
Shawn
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or