0

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 :(

2
Contributors
3
Replies
5
Views
8 Years
Discussion Span
Last Post by Major_Hafez
0

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.

0

Thanks alot (Padtes)

i did it :

void BindData()
    {
        DataTable dt2 = new DataTable();
        da2.Fill(dt2);
        DataList2.DataSource = dt2;
        DataList2.DataBind();
    }
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.