locked
GridView won't refresh automatically RRS feed

  • Question

  • User-828040185 posted

    Hello everybody. I am newbie in C# & ASP.NET and I am learning day by day. I came here to look for advice and help from you :)

    I have an web application for processing education applications. My aspx file has two gridviews .When user send his application column "status" is by default set to false (it means that application is not processed). In first gridview are shown applications that are not processed. Than when admin updates the application he changes value of that column to true (it means that application is processed). 

    Now my problem and question. When value is changed to true, and save button is pressed, this row automatically disappears from gridview1, but it is not shown in griedview2. Only when i change to other aspx page and come back, second gridview is "refreshed" and it shows my processed applications. It is the same, when i try to set value to false in griview2.

    Is there any way to create situation that when i press save update button in gridview1 and data is deleted from gridview1 that it is automatically showed in gridview2 without going to another page and coming back. All data binding is created in aspx file trough griedview and datasource option, not a single line has written in "code behind".

    EDIT: I have found an answer, I am sorry that I didn't try this before asking questions.

    I added this in "code behind"

    protected void gridview1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
            {
                gridview2.DataBind();
            }

    And this works like a charm.

    Saturday, July 16, 2016 9:16 PM

Answers

  • User-271186128 posted

    Hi Goran_C#,

    Glad to hear that you have solved your problem by yourself.

    With regards,
    Dillion

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 18, 2016 9:17 AM