Question

 <asp:Repeater ID="rpt_slider" runat="server" OnItemDataBound="rpt_slider_ItemDataBound">
    <ItemTemplate>
 <cc:HtmlEditor ID="Htmleditor1" runat="server" Height="300px" Width="550px" DialogButtonBarColor="Gray" DialogHeadingColor="Gray" DialogUnselectedTabColor="Gray" TabBackColor="Gray" Text='<%# Eval("banner_text")%>' DialogSelectedTabColor="Gray" EditorBorderColor="Gray" SelectedTabBackColor="Maroon" ToolbarColor="Silver" ToolstripBackgroundImage="Default" ButtonMouseOverColor="Gray" SelectedTabTextColor="WhiteSmoke" TabbarBackColor="Gainsboro" TabMouseOverColor="Gray"  DialogSelectedTabTextColor="White" />
</ItemTemplate>
  </asp:Repeater>

how to get here text of html editor from Repeater...

here Text='<%# Eval("banner_text")%>' are bound on repeater and how to get text on my c# code??

Était-ce utile?

La solution 2

FINNAY I GOT MY SOLLUTION.

protected void btnUpdate2_click(object sender, EventArgs e)
        {
            try
            {
                Button ib = (Button)sender;
                // string index = (ib.CommandName);
                RepeaterItem gr = (RepeaterItem)ib.NamingContainer;
                int index = gr.ItemIndex;

                property.banner_type = "Primary";
                property.active = Convert.ToBoolean(((CheckBox)rpt_slider.Items[index].FindControl("checkActive")).Checked);
                property.banner_index = Convert.ToInt32(((DropDownList)rpt_slider.Items[index].FindControl("drop_IndexNo")).SelectedValue);
                property.banner_id = Convert.ToInt32(ib.CommandArgument);
                property.bottom_pos = Convert.ToInt32(((TextBox)rpt_slider.Items[index].FindControl("txtBPOS")).Text);
                property.right_pos = Convert.ToInt32(((TextBox)rpt_slider.Items[index].FindControl("txtRPOS")).Text);
                property.cr_user = Convert.ToInt32(Session["admin_id"]);
                property.cr_date = Convert.ToDateTime(DateTime.Now.ToString());
                property.banner_text = Convert.ToString(((HtmlEditor)rpt_slider.Items[index].FindControl("Htmleditor1")).Text);
                property.tag = 2;
                try
                {
                    int result = 0;
                    result = balss.banner_insert(property.banner_id, property.banner_type, "", "", property.active, property.banner_index, property.cr_user, property.cr_date, property.banner_text, property.bottom_pos, property.right_pos, property.tag);
                    if (result > 0)
                    {
                        ClientScript.RegisterStartupScript(this.up1.GetType(), "Script", "<script type='text/javascript'>alert('Record Updated successfully.');</script>");

                    }

                }
                catch (Exception ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "script", "<script text='text/javascript'> alert('" + ex.Message + "')</script>");
                }
                finally
                {
                }
                getdata();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>alert(' " + ex.Message + "');</script>", false);
            }
            finally
            {
            }
            Response.Redirect("edit_banner");


        }
on button submit click i am used 
 property.banner_text = Convert.ToString(((HtmlEditor)rpt_slider.Items[index].FindControl("Htmleditor1")).Text);
for get value of html editor for repeater.

Autres conseils

Try this... I 've tested your tool.. It works..
Add using Winthusiasm.HtmlEditor; as shown below. Then you can access your editor from server side. You can use below method to find the Editor from your repeater. By using editor.Text, You can get Editor's Text

If you did't add the Reference DLL Please add it to your references. Otherwise you 'll get errors when you put using Winthusiasm.HtmlEditor;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Winthusiasm.HtmlEditor;

namespace ListDrop
{
    public partial class _Default : System.Web.UI.Page
    {



        protected void Page_Load(object sender, EventArgs e)
        {
            foreach (RepeaterItem item in Repeater1.Items)
            {
                if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
                {
                    Editor editor= (Editor)item.FindControl("Editor1");
                    lblMessage.Text = editor.Text;


                }
            }
        }





    }
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top