I have made a site using the original GridView of asp.net 2, and i have the trouble that inside an UpdatePanel (i'm using Microsoft Ajax) the add/update/delete operations are very slow even if i have attempted every optimization; but i have a dozen of grids inside the page, even if with a few records (and there are many editable fields)
In the online samples for WebDataGrid i'm seeing only ObjectDataSource as datasource for grids, while in my site i'm using an ADO.NET DataTable; so my questions , in order to download the Infragistic trial and try a conversion, are:
1) DataTable as source for the WebDataGrid
2) Is it possible to create a new row with clicking a button? i'm seeing only samples where the new row is already present
3) In a grid i have the first editable field as a DropDown, changing the selected index in other 2 fields i should activate 2 numeric fields (when the value of the first DropDown is "OTHER") or others 2 combos , dinamically filtered by the first dropdown SelectedValue (obviously except when the value of the first dropdown is "OTHER"); the DropDowns datasources are DataTables
4) numeric input: is it possible to avoid that the user write more digits than the expected picture: for example if i want that the user could enter only 2 integers and 2 decimals (max number allowed 99,99) is it possible to avoid that the user could write 999,999?
5) My site is using UpdatePanel and some other controls from Microsoft Ajax Toolkit: apart UpdatePanel, used exclusively for GridViews, the others controls does not have problems adding the Infragistic grid in the page? and i'm using Page Methods, will these continue to work ?
Thank you for the help.
Actually i'm trying with the UltraWebGrid, not the WebDataGrid, because there are more samples; i'm using .net 2
Now is working the adding by clicking a button , but it seems not possible to activate the cursor on the first editable field: if i start to type after clicking the "add new" button the text appear in the field, but the users tipically needs the blinking cursor ...
I have tried the event AfterRowInsertHandler :
in the Grid definition there is
<ClientSideEvents AfterRowInsertHandler="grdStentsLAD_AfterRowInsertHandler" />
and my script is
function grdStentsLAD_AfterRowInsertHandler(gridName, rowId) { var oRow = igtbl_getRowById(rowId); var oCell = oRow.getCellFromKey('Type'); oCell.activate(); oCell.setSelected(true); oCell.beginEdit(); }
I have verified with the debugger (i'm using Visual Studio2008) that the js code is executed, but the blinking cursor does not appear in the field (UltraGridColumn): could be that it works applying the latest service pack? (i have seen that is downloadable only by registered users, i'm using the trial evaluation)
Best Regards
Roberto Alessi
Rumen Stankov"]Question #2 - Is it possible to create a new row with clicking a button? i'm seeing only samples where the new row is already presentWell, yes, it really depends on your setup and/or do you want to have this behaviour run on the server or on the client, but let's say you start with a grid that have RowAdding behavior (child of the EditingCore behavior) set, but it is disabled by default.The grid would look like this: <ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" Width="400px"> <Behaviors> <ig:EditingCore> <Behaviors> <ig:RowAdding Enabled="false"> </ig:RowAdding> </Behaviors> </ig:EditingCore> </Behaviors> Then, on a postback event, you would simply have something similar to this to enable it back: protected void Button1_Click(object sender, EventArgs e) { WebDataGrid1.Behaviors.EditingCore.Behaviors.RowAdding.Enabled = true; }If you wish to experiment with what is available on the client side with javascript (we call this CSOM - client-side object model), I recommend starting from this page in our online help - it provides great help on the RowAdding behavior. For example you can add a new row using something similar to this (you need to have EditingCore behavior enabled) and then just set its editing mode to enabled, e.g.var grid = $find("<%= WebDataGrid1.ClientID %>"); grid.get_rows().add(cellValuesArry); But then again, it really depends on your scenario. More info on that can be found in the help here: http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebDataGrid~Infragistics.Web.UI.RowAdding_members.html
Question #2 - Is it possible to create a new row with clicking a button? i'm seeing only samples where the new row is already present
Well, yes, it really depends on your setup and/or do you want to have this behaviour run on the server or on the client, but let's say you start with a grid that have RowAdding behavior (child of the EditingCore behavior) set, but it is disabled by default.The grid would look like this:
<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" Width="400px"> <Behaviors> <ig:EditingCore> <Behaviors> <ig:RowAdding Enabled="false"> </ig:RowAdding> </Behaviors> </ig:EditingCore> </Behaviors>
Then, on a postback event, you would simply have something similar to this to enable it back:
protected void Button1_Click(object sender, EventArgs e) { WebDataGrid1.Behaviors.EditingCore.Behaviors.RowAdding.Enabled = true; }
If you wish to experiment with what is available on the client side with javascript (we call this CSOM - client-side object model), I recommend starting from this page in our online help - it provides great help on the RowAdding behavior. For example you can add a new row using something similar to this (you need to have EditingCore behavior enabled) and then just set its editing mode to enabled, e.g.
var grid = $find("<%= WebDataGrid1.ClientID %>"); grid.get_rows().add(cellValuesArry);
But then again, it really depends on your scenario. More info on that can be found in the help here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR3.5/html/WebDataGrid~Infragistics.Web.UI.RowAdding_members.html
Question 3) In a grid i have the first editable field as a DropDown, changing the selected index in other 2 fields i should activate 2 numeric fields (when the value of the first DropDown is "OTHER") or others 2 combos , dinamically filtered by the first dropdown SelectedValue (obviously except when the value of the first dropdown is "OTHER"); the DropDowns datasources are DataTables.
Well yes, but again it really depends on your setup - e.g. are the other controls that need to be filtered by the grid inside the same cell or in different cell? Or are they inside or outside the grid, etc, etc.
The easiest approach would be to create this logic outside the grid (e.g. enable/filter dropdowns based on other dropdown) and then simply embed the same functionality inside a grid templated column - in a templated column you can have any controls / html you wish and can inside the ItemTemplate, e.g.
<Columns> <ig:TemplateDataField> <ItemTemplate> ... </ItemTemplate> </ig:TemplateDataField>
Question #5 - 5) My site is using UpdatePanel and some other controls from Microsoft Ajax Toolkit: apart UpdatePanel, used exclusively for GridViews, the others controls does not have problems adding the Infragistic grid in the page? and i'm using Page Methods, will these continue to work ?
Yes, in fact this is one of the reasons we started that Aikido project - it is built specifically for ASP.NET AJAX Extensions and relies on the ASP.NET AJAX server-side and client-side object model - including UpdatePanel, ScriptManager, etc. Even in our online samples, we use UpdatePanels in almost every example.
As far as Microsoft Ajax Toolkit is concerned - we have tested our products with many controls from the Ajax Toolkit, but since this is an ongoing and ever evolving project (and ufortunately, not officially supported by Microsoft), we cannot guarantee that every single feature of our Aikido products will work with every single feature, version and control from Ajax Control Toolkit, but we are doing our best to ensure this is the case.
Question #4 - numeric input: is it possible to avoid that the user write more digits than the expected picture: for example if i want that the user could enter only 2 integers and 2 decimals (max number allowed 99,99) is it possible to avoid that the user could write 999,999?
Yes, this is possible - The WebDataGrid includes several built in editor providers that can be used to customize the editing experience - Text Editor, Date Chooser, Numeric Editor, and Slider Editor. In your case, what you need is the Numeric Editor. They are available off the EditorProviders collection directly under the WebDataGrid declaration. You can customize each of the providers using numerous properties, for example:
<ig:WebDataGrid ...
<EditorProviders> <ig:WebTextEditProvider ID="BasicTextProvider" /> <ig:WebNumericEditProvider ID="FreightValueProvider" DataMode="Decimal" MinDecimalPlaces="2" MinValue="0" MaxValue="100"/> <ig:WebDateChooserProvider ID="DateInputProvider" /> <ig:SliderProvider ID="QuantityValueProvider"> <EditorControl ID="EditorControl1" runat="server" MinValueAsString="0" MaxValueAsString="100" ContentAlignment="Center" ValueType="Int" Width="200px" /> </ig:SliderProvider></EditorProviders>
...
</ig:WebDataGrid>
After that, you simply have to map Editor IDs to the actual column in the EditingCore.CellEditing behavior, for example:
<Behaviors> <ig:EditingCore> <Behaviors> <ig:CellEditing Enabled="true" > <ColumnSettings> <ig:EditingColumnSetting ColumnKey="CustomerID" ReadOnly="true" /> <ig:EditingColumnSetting EditorID="BasicTextProvider" /> <ig:EditingColumnSetting ColumnKey="OrderDate" EditorID="DateInputProvider" /> <ig:EditingColumnSetting ColumnKey="ShippedDate" EditorID="DateInputProvider" /> <ig:EditingColumnSetting ColumnKey="Freight" EditorID="FreightValueProvider" /> <ig:EditingColumnSetting ColumnKey="Quantity" EditorID="QuantityValueProvider" /> </ColumnSettings> </ig:CellEditing> </Behaviors> </ig:EditingCore> </Behaviors>
and that's it.
There is a great live example on how to achieve that available here