Question

I have radlistview. I add datasource to listview when page_load. But when I clicked I button in same page. I lost datasource of listview. Why? how can I fix it?

Était-ce utile?

La solution 2

I found the solution. I added EnableViewState="true" property and problem fixed. Like this

<telerik:RadListView ID="lvDSTableSelection" runat="server" AllowMultiItemSelection="true" OnSelectedIndexChanged="lvDSTableSelection_SelectedIndexChanged" EnableViewState="true" >

Autres conseils

Try putting your listview databinding code inside something like this.

protected void Page_Load(object sender, EventArgs e)
{
    if(!IsPostBack)
    {
        myListview.DataSource = myDatasource;
        myListView.DataBind();
    }
}

You may also want to consider using UpdatePanels if you wanting to only postback a part of the page, rather than the whole page.

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