This is a migrated thread and some comments may be shown as answers.

How to use webBrowserElement in a radListView?

1 Answer 118 Views
ListView
This is a migrated thread and some comments may be shown as answers.
gzzn
Top achievements
Rank 1
gzzn asked on 28 Oct 2015, 05:44 AM
// 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);
    }
}

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 28 Oct 2015, 11:04 AM
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
Tags
ListView
Asked by
gzzn
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or