Culture:
User Id: Password:

Syrinx, Inc.

From .NET Training to Enterprise Architectures

 

Issues with Nitobi while accessing on server side

Pages:  [1]
Jun 2, 09 -4:21 PM
Hi All,I am facing 3 major issues while using Nitobi grid on server side.1. If I add runat="server" tag to Nitobi grid, it just shows "Loading..." symbol on page. Grid doesn't get loaded properly.2. I coludn't find out way for creating and assigning datasource to Nitobi grid on server side.3. There is lots of server side logic and communication in my page and for which I need to iterate the grid in code behind.     I tried to search but couldn't find any post which explains how to iterate nitobi grid in C#.NET. Suprisingly, the grid has Columns collection but not the Rows collection and also doesn't have IEnumerator.Please let me know if you have any idea about any of these issues.Below is my sample grid markup: <ntb:Grid ID="FlightGrid"                         width="520"                            height="200"              mode="locallivescrolling"               datasourceid="FlightData"               toolbarenabled="true"               copyenabled="true"                        livescrollingmode="Leap"              onafterpasteevent="test(eventArgs)"           theme="nitobi" StylesheetUrl="nitobi.grid.css"  OnBeforePasteEvent="callMeBeforePaste(eventArgs)">           <ntb:columns>                          <ntb:textcolumn  label="Flight No"  xdatafld="FN" oncellvalidateevent="validateNameCell('Last', eventArgs)"></ntb:textcolumn>              <ntb:textcolumn  label="Bkg Class" xdatafld="CLASS" oncellvalidateevent="validateNameCell('First', eventArgs)"></ntb:textcolumn>              <ntb:datecolumn  label="Date" xdatafld="FLDATE" initial=" " editable="true" oncellvalidateevent="validateDateFormat('DOB', eventArgs)">                    <ntb:dateeditor calendarenabled="true" mask="dd-MMM-yyyy"></ntb:dateeditor>              </ntb:datecolumn>                              <ntb:textcolumn  label="From" xdatafld="ORG" oncellvalidateevent="validateTypeCell(eventArgs)"></ntb:textcolumn>                   <ntb:textcolumn  label="To" xdatafld="DEST" oncellvalidateevent="validateMealCell(eventArgs)"></ntb:textcolumn>                                                    </ntb:columns>         <ntb:datasources id="FlightDataSources">            <ntb:datasource id="FlightData">                <ntb:datasourcestructure FieldNames="FN|CLASS|FLDATE|ORG|DEST"></ntb:datasourcestructure>                <ntb:data>                                        <ntb:e ></ntb:e>                </ntb:data>            </ntb:datasource>          </ntb:datasources>                          </ntb:Grid>   
guravman
Joined: Jun 2, 09
Jun 3, 09 -7:05 AM

The Grid doesnt have a rows collection because that would force you to move your data from your original data source to some artbitrary format like rows for the grid.  In order to be flexible, there are actually several ways you can provide data to the grid, but to get started with the most simplest way, you bind your data source to the grid in a way similar to the standard ASP.NET grid. 

The grid has a Data property, which you can bind your data to.  Here is an example right out of the ASP.NET demo's SimpleDataGrid.aspx page:

            if (Session["customers"] == null)
            {
                ArrayList l = new ArrayList();
                l.Add(new Customer("0", "John", "Smith"));
                l.Add(new Customer("1", "Mark", "Aldrin"));
                l.Add(new Customer("2", "Matthew", "Jones"));
                l.Add(new Customer("3", "Luke", "Kettle"));
                Session["customers"] = l;
            }
            g.Data.provider().GetData += new Nitobi.GetDataHandler(SimpleDataGrid_GetData);
 

Notice the last line where I am giving my data to the grid to use.  In order to use the grid you must provide the data first.  That means you already have the data.  Also, in your example, you are using the client side xml for the grid rather than the way it should be setup in ASP.NET.  For example, the ASP.NET library doesnt put the event handles directly on the Grid element.  It has a child element called GridEvents which has all the properties on it:

<ntb:Grid runat="server" id="grid"><GridEvents CellValidate="alert('validate')" /></ntb:Grid>

matt
Joined: Dec 12, 08
Pages:  [1]

Syrinx.ph © 2007 - 2010
All other company names, logos and trademarks appearing in this website are the property of their respective owners.
Powered by Syrinx CS