locked
asp.net listview not refreshes RRS feed

  • Question

  • User1126057398 posted

    Listview contains Dropdown in Item Template and has other feature like Edit/Delete. Everything is working fine. The only issue is that when I change something from dropdown, listview is not refreshed. Though next time when it is postbacked, changed Data comes. I am binding Listview with datatable. What can be the reason?

    Before binding to DataTable, I had set datasource to null, so that it rebinds. Still it's not workingembarassed

    lvPDiet.DataSource = null; lvPDiet.DataBind();

    Tuesday, October 15, 2019 6:35 AM

Answers

  • User1126057398 posted

    Solved the problem by calling dropdown SelectedIndex changed method forcefully. In Jquery, I had set a variable IsDDClicked=1 and in ListView Bind method, checked if Dropdown is clicked ie if IsDDClicked=1, then fired dropdown Selected index like: dlFndEqu_SelectedIndexChanged(null, null);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 15, 2019 11:24 AM

All replies

  • User-719153870 posted

    Hi geetasks,

    There's an attribute called autopostback in Dropdownlist control, if you want this control's change event be fired, this attribute needs to be set to "true".

    I believe your problem can be fixed by this little change rather than calling dropdown SelectedIndex changed method forcefully.

    Or, you can provide your aspx code and let's see if there's other reason that might cause your problem.

    Best Regard,

    Yang Shen

    Tuesday, October 15, 2019 7:33 AM
  • User1126057398 posted

    Thanks for replying. But after setting DataSource to null, I had re-binded to datatable but it didn't display the refreshed data in dataTable. But if I click on say Edit, then new data(selected from dropdown) comes.

    Tuesday, October 15, 2019 9:16 AM
  • User1126057398 posted

    Solved the problem by calling dropdown SelectedIndex changed method forcefully. In Jquery, I had set a variable IsDDClicked=1 and in ListView Bind method, checked if Dropdown is clicked ie if IsDDClicked=1, then fired dropdown Selected index like: dlFndEqu_SelectedIndexChanged(null, null);

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 15, 2019 11:24 AM