Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
RowEditTemplate, UltraGrid & custom DataSource = can't do it
posted

Hi everybody,

I'm having a problem with RowEditTemplate concerning its grid's DataSource.
I basically have to display some data from a DB into an UltraGrid and be able to edit them through a RowEditTemplate, but It seems like I can set up a designer-created RowEditTemplate for an UltraGrid only by means of a designer-created DataSource.

As I want to have a better control on my data and my code, I prefer to programmatically initialize a DataSet, populate it with tables (filled by my custom queries) and use it as DataSource for my grid. But this way the designer won't let me manage the RowEditTemplate and I have to set it up manually. And this would be painful as I'd have to manage a large number of controls for a large number of fields.

So is there a way to solve this problem? Thank you in advance,

Giorgio

Edit:
well, if VisualStudio would not separate the designer-generated code from the rest of the code putting it in another and quite untouchable file, there would be no problem at all I suppose. Editing that part of code would do the job but ... you just can't 'cause that code is practically ... a ghost :P

Parents
  • 37774
    Suggested Answer
    posted

    Giorgio,

    There isn't really anything that's preventing you from setting up the RowEditTemplate at design-time.  The only real limitation is that if you don't define the schema on the grid at design-time, there isn't really any way for the RET wizard to automatically generate the proxies and labels for fields.  What you would need to do in order to make this fully dynamic is to create an UltraLabel and an UltraGridCellProxy at run-time for each column in your data source and add it to your RowEditTemplate.  You would need to set the ColumnKey property on each proxy to match up to a column in the band with which the template is associated.  You do miss out on any automatic layout logic, but all the wizard does is position each control from top-to-bottom and then left-to-right.  If you have access to the source code, you can take a look at the Design assembly's code to see how this is done.

    -Matt

Reply Children