G
Giulio Petrucci
Hi there,
I'm trying to use a DetailsView control without any datasource and I've
been spending the whole morning dealing with the following issue. Here
is my DetailsView markup code:
<aspetailsView Visible = "true" ID="fooGrid"
AutoGenerateEditButton="true" ...>
<Fields>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="true"/>
<asp:BoundField DataField="Label" HeaderText="Label"/>
</Fields>
</aspetailsView>
I'm using this control to show an instance of a Foo class:
class Foo
{
public string Name { get; set; }
public string Label { get; set; }
}
in my asp.net page code behind, I have the following code to bind my Foo
instance to the control:
//instance menber;
Foo foo = ... ;
//and the following code is within the Page_Load code
fooGrid.DataSource = new Foo[] { foo };
fooGrid.DataBind();
And here comes the problem.
I click on the "Edit" button, the edit the "Label" field and change it.
If i click on the "Update" confirmation button, the 'foo' instance
'Label' property value is not changed: it's still the old one.
Where am I wrong? Any suggestion? Links?
Thanks in advance,
Giulio - Italia
I'm trying to use a DetailsView control without any datasource and I've
been spending the whole morning dealing with the following issue. Here
is my DetailsView markup code:
<aspetailsView Visible = "true" ID="fooGrid"
AutoGenerateEditButton="true" ...>
<Fields>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="true"/>
<asp:BoundField DataField="Label" HeaderText="Label"/>
</Fields>
</aspetailsView>
I'm using this control to show an instance of a Foo class:
class Foo
{
public string Name { get; set; }
public string Label { get; set; }
}
in my asp.net page code behind, I have the following code to bind my Foo
instance to the control:
//instance menber;
Foo foo = ... ;
//and the following code is within the Page_Load code
fooGrid.DataSource = new Foo[] { foo };
fooGrid.DataBind();
And here comes the problem.
I click on the "Edit" button, the edit the "Label" field and change it.
If i click on the "Update" confirmation button, the 'foo' instance
'Label' property value is not changed: it's still the old one.
Where am I wrong? Any suggestion? Links?
Thanks in advance,
Giulio - Italia