0

I Want to bind detailsview to the page manually , for example

I Have a linqdatasource as declared here in design mode..

On a page load event I have written following..

protected void Page_Load(object sender, EventArgs e)
{
    DetailsView dv = new DetailsView();
    dv.AllowPaging = true;
    dv.DataSource = LinqDataSource1;
    dv.DataBind();
    this.Controls.Add(dv);
}

but i got error like this..

Control 'ctl02' of type 'DetailsView' must be placed inside a form tag with runat=server.

4

1 回答 1

0

在 ASPX 中的表单内添加一个占位符,并将您的详细信息视图从后面的代码添加到占位符。

于 2012-08-15T08:52:20.793 回答