954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to Made DataList reload results in same page after Submit Editing !!

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

Major_Hafez
Newbie Poster
11 posts since Jul 2009
Reputation Points: 10
Solved Threads: 1
 

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.

padtes
Junior Poster in Training
86 posts since Aug 2009
Reputation Points: 53
Solved Threads: 20
 

Need more Explanation, please !!

sorry , i'm Still Beginner :|

Major_Hafez
Newbie Poster
11 posts since Jul 2009
Reputation Points: 10
Solved Threads: 1
 

Thanks alot (Padtes)

i did it :

void BindData()
    {
        DataTable dt2 = new DataTable();
        da2.Fill(dt2);
        DataList2.DataSource = dt2;
        DataList2.DataBind();
    }
Major_Hafez
Newbie Poster
11 posts since Jul 2009
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: