Hi all,

i had Web Page include DataList control , TextBox and Button ..


DataList1 : Getting Data from SQLDB

TextBox : for Editing Selected Field in DataList

Button : Submit Editing


when i Click Button it Editing Data Succefully in SQLDB , but in same Time DataList Control doesn't changed untill i refresh the Page !!

how could i make DataList changing Data or Reloading it after Submit Edit in same Page without need to Refresh the Page .. !!


i Hope u understand me , Sorry for My Weak English :(

Recommended Answers

All 3 Replies

When you say data is updated in the database, you mean you have handled the page postback correctly.
Also you are saying the datalist is filled correctly when page is refreshed, that means, the datalist filling code is there and working AND the datalist depends on your latest update.
All you have to do is, logically, after updating database, fill the datalist and bind again. One of the standard practices is: add private method that will fill datalist. Call it on page load when not postback as well as call after database update.
If this helps, please mark thread as solved.

Need more Explanation, please !!

sorry , i'm Still Beginner :|

Thanks alot (Padtes)

i did it :

void BindData()
    {
        DataTable dt2 = new DataTable();
        da2.Fill(dt2);
        DataList2.DataSource = dt2;
        DataList2.DataBind();
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.