Ich habe 2 Update-Panel in einem Update-Panel Ich habe einen Datenlogger und in anderen Update-Panel habe ich ein Textfeld mit tinymce Editor.Verlust von TextBox-Wert bei Verwendung von UpdatePanel in Ascx?
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DataList ID="dlst1" runat="server" RepeatDirection="Horizontal" CellSpacing="5" CellPadding="7"
DataKeyField="Id" CaptionAlign="Left" OnItemCommand="dls1_ItemCommand"
OnItemDataBound="dlst1_ItemDataBound">
<ItemTemplate>
<asp:ImageButton ID="btnImg" OnClientClick="javascript:void(0);"
runat="server" ImageUrl='<%#"~/Controls/Images.ashx?FileName=" +DataBinder.Eval(Container.DataItem, "FilePath") %>'
CommandName="Select" OnCommand="Select_Command"
CommandArgument='<%# Eval("Id").ToString() ' />
</ItemTemplate>
</asp:DataList>
</ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:TextBox ID="TextBox1" CssClass="tinyEditor" ClientIDMode="Static" runat="server" TextMode="MultiLine"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
für tinymce machen arbeitete ich
bin mitScriptManager.RegisterClientScriptBlock(UpdatePanel2, this.GetType(), "init", "tinyMCE.execCommand('mceAddControl', false, '" + TextBox1.ClientID + "');", true);
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(function() {
TinyMCEEditor();
});
$(function() {
TinyMCEEditor();
});
mein TinyMCE Editor
function TinyMCEEditor() {
tinyMCE.init({
mode: "textareas",
theme: "advanced"
});
}
auf Seite laden.
Ich gebe den Text für jedes Bild, für das vorherige Bild Ich speichere den Textbox Wert in einem Ansichtszustand, nehme an, ich habe 3 Bilder für Bild 1 Ich habe den Text abcd gegeben und Bild2, so Bild 1 Text wird im Viewstate gespeichert.
auf Select_Command:
if (ViewState["txbtext"] != null)
txbtext= (Hashtable)ViewState["txbtext"];
int index1 = previouslySelectedIndex;
if (index1 != -1)
{
ImageButton imgbtn= (dlst1.Items[index1].FindControl("btnImg") as ImageButton);
if (imgbtn!= null)
{
string[] ImgStr = imgbtn.CommandArgument.ToString().Split(';');
Int32 selectedId = Convert.ToInt32(Str[0]);
if (txbtext!= null && txbtext.ContainsKey(selectedId))
txbtext[selectedId] = textbox.Text;
else
txbtext.Add(selectedId, textbox.Text);
}
}
ViewState["txbtext"] = txbtext (//this is the hashtable);
}
, als ich es funktioniert gut nicht Update Panel verwenden, aber wie ich Update-Panel verwende ich bin der Textbox Wert in Ansichtszustand zu speichern,
nicht in der Lage Bitte jemand sagt mir, wie kann ich dieses Problem beheben, wenn möglich etwas exp geben. Code.
mir Irgend jemand plz help
seine nicht die Lösung um den Editor zu ändern, ich bin mit TinyMCE hinzugefügt haben An vielen Stellen könnte ich meinem Redakteur auch die Client-Anforderung ändern – Rocky