Initialize same settings for a devexpress control in multiple forms - devexpress

I'm using the PropertyGrid control from DevExpress in multiple forms.
I have a ImageComboBoxEdit with the same settings (same ImageList, ItemList and multiple settings) on all of the forms.
I want all of them to have the same settings on the forms and don't want to go through all the forms to add a new option in the Combo.
What would be the best practices to implement this?
I've tried inheriting the RepositoryItem with limited success. Another idea would be to create a static helper class to initialize the default ImageComboBoxEdit with the right settings.
What would you prefer? Any other ideas?
Gunnar Steinn

One more idea is to use the comboBox on a UserControl. Thus, you will have to adjust it only once and then use this UserControl on as many forms as you want.

Related

Webparts asp.net

What are the disadvantages to using webparts in asp.net? Are they losing their popularity?
I was planning on creating a user defined Dashboard and was thinking of using Webparts, is this the way to go or is there another way of doing customisable dashboards these days? I would prefer not to have to use a 3rd party product.
To me, webparts are more of a sharepoint thing these days.
Other than that, with some design you can get all you need with user controls and some classes of your own to get common functionality and layout sorted out.
Say you have a base class called DashboardWidget that inherits from WebControl here you could define a overridable method
ProcessDataSource -> executes a query to a database or service and formats the results for presentation
And in the prerender method (or something similar along the asp.net lifecycle) you call ProcessDataSource (you could use the DataSource property most controls already have).
Then you inherit from DashboardWidget to make your controls and in the render method you override ProcessDataSource to get the info the way you need and the Render method to setup what to display.
Ideally you should define your own data source class to have a single place to define where to connect, how, credentials, etc..
As for the layout, newer versions of asp.net include several layout option you may use (and there is always pure html if you want)
I'm shooting from the hip a bit here, but that's a way to do it without involving webparts, that to me, are not that popular outside of sharepoint.
Hope anything of this helps

asp.net webform pattern re-use same page (view and edit)

i'm working on a project which aim is to create a sort of social portal.
The matter is that i've an entity page detail where user can edit it or just view it.
I'm considering to create just one page and using that as view only and edit mode at the same time.
I had two ideas:
1) create an enumeration ControlBehaviour { EditMode, ViewMode } in Session and using that to understand if I have to set readonly every controls in my page;
2) use jquery to set readonly every controls in the page if i have to open it in viewmode (or not readonly if i have to open it in edit mode).
Does it exist any pattern to reach my aim?
best regards
Separating your concerns into read and edit forms is most suitable, in terms of maintaining your code afterwards, by yourself or for someone else.
The DetailsView control is exactely what you are looking for

asp.net datagrid

I want a asp.net datagrid with client side selection and dockable in pages and custom rightclick support.
cau anyone help me?
You will need to add javascript in case to make the table interactive with user actions
i prefer to use jQuery plugins to able you to do that. just create css classes and assign them in the datagrid columns then use jQuery to add the right click support and dockable rows.
If you have the budget Telerik RadGrid can do what you want and more. (You will also need RadDock for docking - they all are part of RadControls.)

Asp.net User Control with underlying control editor functionality

ASP.Net 3.5
I want to create a user control that contains the ListView and DataPager controls along with some custom code in the ItemDataBound that is generic and deals with UI styling.
Ideally, when the developer uses this control, I would like to retain editor support so they can select a datasource, add/remove columns, etc...
Is this easy? If so, any references on how to do this?
If it is not possible, what alternatives are there?
The reason I am trying to create the user control is to make it easier on the developers to retain the ui look and feel and to encapsulate common UI styling code.
You'll need to use the Facade pattern to delegate the exposed designer properties to the composed inner controls.
In my opinion it's honestly not worth the effort it would take to wire up nicely.

Difference between User Control and Custom Control?

What are the differences between User Control and Custom Control in ASP.NET
AFAIK, user controls are controls that you can create out of existing controls and can be part of the project and have a designer surface for you to drag/drop.
Custom controls are generally external to the project & would require to be hand-coded (using various asp.net control events & html building in the code).
User Controls are inherit from UserControl class by system default and can combine controls in terms of specific UI case and can have UI logic as well and reuse again and again anywhere within project.
Custom Controls are inherits from Control class (that you can change any control type what you want to customize) and generally use to add extra ability to an existing UI controls.
Difference between CustomControl and UserControl
So, now you got the difference between Custom Control and User Control, I guess. Let's summarize the difference again. Read the comparison below to make it clear:

Resources