Ok, I have done simple overrides before so I coded up
protected override Auto...
well, I didnt even get that far as intellisense made it clear that AutoGeneratedField is not part of my class ..
public partial class printit : System.Web.UI.Page
So I tried adding "DetailView" to the class so I could inherit it (this was just a wild guess that once worked in c++ for me)
Expand|Select|Wrap|Line Numbers
- public partial class printit : System.Web.UI.Page, System.Web.UI.WebControls.DetailsView
- {
There is a really good example of what I want to do here but the author leaves the description on how to "use it" for a later date.
Question: What do I put in to my C# page that willl cause the override to be fired? I assume I have to inherit the class that does the firing and I do not know enough about inheritance to do this.
I have set GridView1.AutoGenerateColumns=True and coded up the following, but the override is never called.
Expand|Select|Wrap|Line Numbers
- public class MyDetailsView : DetailsView
- {
- public MyDetailsView()
- {
- }
- protected override AutoGeneratedField CreateAutoGeneratedRow(AutoGeneratedFieldProperties fieldProperties)
- {
- AutoGeneratedField field = new AutoGeneratedField(fieldProperties.DataField);
- return field;
- }
- }
- public partial class printit : System.Web.UI.Page
- {
- ...rest of my program...
===wait wait wait===
ok, just realized I should have used MyGridView instead of the above "MyClass" and then used MyGridView when createing GridView1 . That gets me a bunch of new overrides though not the one I am looking for. However, I am in the right direction.