How to use webBrowserElement in a radListView?

2 posts, 0 answers
  1. gzzn
    gzzn avatar
    12 posts
    Member since:
    Jan 2011

    Posted 28 Oct 2015 Link to this post

    // Use the following code can only show the Html file, how to display the web page?
     
    private void radListViewMarketBase_CellCreating(object sender, ListViewCellElementCreatingEventArgs e)
    {
        var cell = e.CellElement as DetailListViewDataCellElement;
        if (cell != null && cell.Data.Name == "SN")
        {
            e.CellElement = new CustomDetailListViewDataCellElement(cell.RowElement, e.CellElement.Data);
        }
    }
    public class CustomDetailListViewDataCellElement : DetailListViewDataCellElement
    {
        // private RadButtonElement _button;
        private RadWebBrowserElement webBrowserElement;
        public CustomDetailListViewDataCellElement(DetailListViewVisualItem owner, ListViewDetailColumn column) : base(owner, column)
        {
        }
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            // this._button = new RadButtonElement();
            // this.Children.Add(this._button);
            this.webBrowserElement = new RadWebBrowserElement
            {
                WebBrowserItem = { Url = new Uri(string.Format("http://www.abc.com.cn/include/map.shtml?d=10&code=000111")) },
            };
            this.Children.Add(this.webBrowserElement);
        }
        protected override Type ThemeEffectiveType
        {
            get { return typeof(DetailListViewHeaderCellElement); }
        }
        public override void Synchronize()
        {
            base.Synchronize();
            this.Text = "";
            // var rowView = this.Row.DataBoundItem as DataRowView;
            // if (rowView != null)
            //     this._button.Text = rowView.Row["序号"].ToString();
            // else
            //     this._button.Text = @"222";
        }
        public override bool IsCompatible(ListViewDetailColumn data, object context)
        {
            return data.Name == "SN" && base.IsCompatible(data, context);
        }
    }

  2. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 28 Oct 2015 Link to this post

    Hello,

    Thank you for writing.

    I have tested this and the page is displayed on my side (see attached image). What are the results on your side?

    I am looking forward to your reply.

    Regards,
    Dimitar
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top