Setting values for custom control inherit from DataGrid

J

Joey Lee

Hi,

I am doing a simple custom datagrid inheriting from DataGrid class.

I would like to set some of the values to something else so that when a user
add the custom control, the properties would already be set.

Example. AllowPaging which is false by default. I want to set to true.
However if the user decided to change it back to none, he would be allowed
todo so thru the normal properties pane in Visual Studio.

Currently in my custom control I override the OnInit method


protected override void OnInit(EventArgs e)
{
base.AllowPaging = true;
base.OnInit (e);
}

By doing so I managed to change the properties pane value of AllowPaging to
true when the user drag the customdatagrid in.

But I faced a problem when the user which to change it back to false for
AllowPaging, it will automatically change it back when i compile it. How do
i set those settings and allow new setting to override it.

However, if i were to do codebehind CDG.AllowPaging = false;. this will
work. but I would like UI manipulation instead.

Thanks

Joey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top