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

Row Disappear on page refresh

3 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brock
Top achievements
Rank 1
Brock asked on 12 Oct 2011, 10:50 PM
So I'm adding a new row to my radgrid.

Then, after I finish inserting the row... I press F5 to refresh the page and my most recently entered row disappears! I'm doing this in debug and running it off my local machine.

If I stop debugging, stop the development server, and then press play to debug...the row appears! However the same thing happens with the next row I insert if I refresh the page again.

I talked with a co-worker about this and he seemed to think it has something to do with the viewstate. Regardless... we're having trouble figuring it out. It's like something is not getting refreshed with my radgrid when the page refreshes.

Any help is greatly appreciated.





3 Answers, 1 is accepted

Sort by
0
Brock
Top achievements
Rank 1
answered on 13 Oct 2011, 01:24 AM
Just some additional information. My radgrid is within a control I created and added to my page. I've had this problem in the past and unfortunately had to solve it by adding the radgrid directly to my page.
0
Shinu
Top achievements
Rank 2
answered on 13 Oct 2011, 05:17 AM
Hello Brock,

I am not quite sure about the event you are creating the Grid. If you are creating in  PageLoad columns and detail table should be added to the corresponding collection first, before the values for their properties are set.

Creating columns in the Page_Load event handler does not work for template columns. For the controls inside a template to persist their ViewState, the grid must be generated completely in the code-behind using the Page_Init event.

When generating a grid in the Page_Init event handler, grid columns should be added to the Columns collection of the MasterTableView after their attributes are set.

Also take a look into the following help article.
Programmatic Creation.

Thanks,
Shinu.
0
Brock
Top achievements
Rank 1
answered on 13 Oct 2011, 02:03 PM
Well right now, I'm not doing any programmatic creation whatsoever.

I have a .ascx control that I've dragged a radgrid control onto. Then on my .aspx page I have a asp container that I use to load that .ascx control into.

Like this...

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
            Dim c As New Control
            c = LoadControl("~/controls/radGrid1CustomControl.ascx")
            ASPContainer.Controls.Add(c)
    End Sub

And when I say I'm adding a row to the radgrid, I mean I'm clicking on the built in add thing on the radgrid itself when it's running.
Tags
Grid
Asked by
Brock
Top achievements
Rank 1
Answers by
Brock
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or