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 ?
1) DataTable as source for the WebDataGrid Yes
2) Is it possible to create a new row with clicking a button? i'm seeing only samples where the new row is already presentYes
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 Yes.
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?Yes5) 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
Thank you, where i can find samples about my requests? i have browsed examples with no luck, could be that i'm not searching in the right place.
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
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
I am going for js being cached :)
Correction: i'm not understanding why (but i'm sure that it was not working) but now the focusing in the first editable field is working.
So my js code in AfterRowInsertHandler is correct, it works.
mistral61 said: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)
Oh, well :) Still, I am sure all that information I wrote will be useful to some developers. Could you please ask UltraWebGrid question in the respective forum located here:
http://forums.infragistics.com/forums/61.aspx
This way it will much easier for everyone to track the conversation and it increases the chance of the question to get good answer.