10433 : Readonly cells

Question

Id like to to prevent a user from editing grid cells.  The only way Ive been able to do this is set:

GridNode.GridControl.Enabled = false

Unfortunately this also prevents the user from scrolling the grid.  Is there a way where I can leave the grid control enabled, but prevent the user from changing the text in the nodes?

Answer

Yes, that is not the recommended approach. Instead you should implement the OnBeforeEditCell event, and set the e.editAllowed=false, it will do the trick much better.

And also it will allow you to evaluate the cell so that it can be made editable under certain dynamic circumstances that you decide.

If you want to dis-allow edit all together you can simple set the GridColumns[x].Readonly=true.

10385 : Id like to develop a Multi-Language ASP.NET – app with gtp.net. The Multi-Language Texts are stored in a Database.

Question

I’d like to develop a Multi-Language ASP.NET – app with gtp.net. The Multi-Language Texts are stored in a Database.

Question1: How can i set month-labels (Jan, Feb, Mar, …)?

Question2: How can i change the look (colour …) of the TodayLine and the VerticalDayStripes?

Answer

GTP.NET Gantt and Gantt_ASP uses windows culture information to get the default day and month names and you can set your own culture like this:
// Culture settings
    private void comboBoxCulture_SelectedIndexChanged(object sender, System.EventArgs e)
    {
      if (comboBoxCulture.SelectedIndex>-1)
      {
        dateScaler1.CultureInfoDateTimeFormat=new CultureInfo( comboBoxCulture.Items[comboBoxCulture.SelectedIndex] as string, false ).DateTimeFormat;
      }
    } 

But if you want to override the texts that end up on the datescaler some other way you can do so by implementing the DateScaler.OnDateScalerDrawString event. Here you get info about time, date and resolution you also get the suggested output and this value you can change to your own localized thru db-lookup value.

Regarding the TodayLine and VerticalDayStripes, both these items will be drawn with the color set in Gantt.TimeItemArea.BackColor

 
 

10386 : Is there a way, that you can save all your preferences of the GanttChart in a XML-File?

Question

Is there a way, that you can save all your preferences of the GanttChart in a XML-File?

So I want to setup a GanttChart, fill the grid on the left, move and add some TimeItems and then click “Save”.
When I click open, the whole GanttChart should be loaded, so that I can edit it.
(MS Project saves it as *.mpp for example).

Answer

There is no built in function to persist all data in a Gantt to a stream, but if you set up your data with databind you can persist the datasources and this is the prefered approach.

It would be a straight forward thing to do such a stream, just iterate all the GridNodes, and for each node all the GanttRows, and for each GanttRow, all Layers and for each Layer all the TimeItems, and for each time item, the time item texts and the time item links.

Maybe we will add this in the future as a good example of iteration, but currently you are regretfully on your own, sorry.

11244 : Zoom in zoom out images in Gantt_ASP is flipped?

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />Question

 

How come the images for zoom in zoom out does the reverse of what they should? + zooms out and – zooms in!

 

Answer

 

There are two common takes on this: + goes closer – goes further away. OR + shows more time and – shows less time… We have chosen the latter one. Right or wrong?  Anyway you can switch the icons by implementing Gantt_ASP.OnGetResource

Implement Gantt_ASP.OnGetResource and when id == “PlexityHide.GTP.WEB.zoomin.gif” etc. you can send in another imageā€¦

10980 : Changing all row heights when one row is changing

Question

I tried to use the OnRowResize event to change all rows while one was changing. The grid starts to flicker and behave weird when doing this…

Answer

To solve this we introduced a new event.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

New event added OnRowResizeDone

 

Event fires when user has resized a row.

You can implement this event to do other changes that you want as a result of a row height change,

like if you want to change all other Grid rows the same way.

 

This event is available from 3.0.9.1

 

So your code can look like this:

 

    /// <summary>

    /// This sample show how to detect a user row height change and how to change all the rows

    /// alike after the user has released the mouse button.

    /// </summary>

    void Grid_OnRowResizeDone(Grid aGrid, RowResizeDoneArgs e)

    {

      for (int i = 0; i < aGrid.GridStructure.RootNodes.Count; i++)

      {

        aGrid.GridStructure.RootNodes[i].UserRowHeight = e.GridNode.Rect().Height;

      }

    }

 

10768 : Is it possible to make the datescalar text align to vertical?

Question

 

Is it possible to make the datescalar text align to vertical vertical orientation, in gtp.net?< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Answer

Currently you must draw the texts yourself in the datescaler if you want them vertical. You can do this in the event OnDateScalerDrawString and then set e.ContinueDraw=false to stop the default text drawing.

 

10563 : Position of the fisheye area?

Question

How can I get the size and the position of the fisheye area? I want to draw a smaller rectangle in the background of the datescaler but I cant find any public properties to get the necessary values.

Answer

New properties has been added to facilitate this as a response to this question:
Exposed readonly properties FishEyeLow and FishEyeHigh. Good when developer needs to draw something special in the fisheye position.

10626 : If im using paging on the gantt is it possible in the code to which page i want to display?

Question

I’ve got a question about the Gantt for ASP.NET 2. If i’m using paging on the gantt is it possible in the code to select which page i want to display. For exemple when the page is loading in the code i would like to display the page 5 of the gantt, is it possible ?

Answer

Yes. The Gantt_ASP.CurrentPage property (int) controls this. The value is stored in a viewstate variable like this

(

int)ViewState[“CurrentPage”]

10867 : I want to set the minimum value for the column width, hows this possible ???

Question

I want to set the minimum value for the column width, hows this possible  ???

Answer

You can implement this event Gantt.Grid.OnColumnWidthChanged.

This event is fired continuously as the user drags the column divider. Check the column value and if you think it is out of bounds set it within bounds in this event.