I hesitate to ask this since its probably a FAQ, but I just havent been able to find the solution.
I have a simple ASP.NET app with a ListBox of article headers+id (populated from a SQL table) and a FCKEditor instance (to edit the article text).
Basically the code-behind looks like this:
The code works, in that I can select an article in the listbox and see the article-text in the editor, then save the article by pressing the SaveButton.
However I dont want a full reload of the page, which causes the editor to disappear and then reapper, which causes a flicker. I have tried to put the editor and save-button inside an UpdatePanel which sort-of works, but the editor is still hidden and shown again, which is annoying.
How can I avoid this behaviour?
Thank in advance, Peter
I have a simple ASP.NET app with a ListBox of article headers+id (populated from a SQL table) and a FCKEditor instance (to edit the article text).
Basically the code-behind looks like this:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ArticlesTableAdapter ata = new ArticlesTableAdapter();
DataBind();
}
}
protected void SaveButton_Click(object sender, EventArgs e)
{
string selected_str = ListBox1.SelectedItem.Value;
int selected_int = Int32.Parse(selected_str);
ArticlesTableAdapter ata = new ArticlesTableAdapter();
DataSet1.ArticlesDataTable adt = (DataSet1.ArticlesDataTable)ata.GetArticleById(selected_int);
if (adt.Count == 0)
return; // no Article found by that #
DataSet1.ArticlesRow row = adt[0];
row.text = FCKeditor1.Value;
int rowsaffected = ata.Update(row);
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
string str = ListBox1.SelectedItem.Value;
ArticlesTableAdapter ata = new ArticlesTableAdapter();
FCKeditor1.Value = (string)ata.GetArticleTextById(Int32.Parse(str));
}
The code works, in that I can select an article in the listbox and see the article-text in the editor, then save the article by pressing the SaveButton.
However I dont want a full reload of the page, which causes the editor to disappear and then reapper, which causes a flicker. I have tried to put the editor and save-button inside an UpdatePanel which sort-of works, but the editor is still hidden and shown again, which is annoying.
How can I avoid this behaviour?
Thank in advance, Peter
