iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
After calling the Row's Delete() method, the Row's GetRowState() method still indicates the row is 'Added'. Shouldn't it be 'Delete'? How can I tell which rows have been deleted or marked for deleted?
Hi,Actually you didn't need to specify it everytime you want to add new row. If you check the sample from Michael Giger, you will see that he only set it at the aspx page at the roottable.<RootTable DataKeyField="ProductID"> Once you set it, then it should be worked, if not, could you send me your simple page that replicate the issue, so I can check it.Best Regards,Gordon Tumewu
Hi,
Actually you didn't need to specify it everytime you want to add new row. If you check the sample from Michael Giger, you will see that he only set it at the aspx page at the roottable.
<RootTable DataKeyField="ProductID">
Once you set it, then it should be worked, if not, could you send me your simple page that replicate the issue, so I can check it.
Best Regards,
Gordon Tumewu
The WebGrid can contain existing rows and new rows where this data is necessary for the existing rows. However, it isn't necessary for new rows even though the Grid is requiring it.
You can utilize the OnRowValidate client-side event of WebGrid for your required scenario.Simply return false if validation is not valid and vice versa. The snippet code below shows a simple implementation of OnRowValidate client-side event. WebGrid will prevent user from leaving a row if “CompanyName” cell of the edited row is empty.function WebGrid1_OnRowValidate(rowObject) { var WebGrid1 = ISGetObject("WebGrid1"); var rootTable = WebGrid1.RootTable; var currentRowIndex = rowObject.rowIndex; if (rootTable.GetRow(currentRowIndex).GetCells().GetNamedItem("CompanyName").Text == "") return false; else return true; }Hope this helps.
You can utilize the OnRowValidate client-side event of WebGrid for your required scenario.
Simply return false if validation is not valid and vice versa. The snippet code below shows a simple implementation of OnRowValidate client-side event. WebGrid will prevent user from leaving a row if “CompanyName” cell of the edited row is empty.
function WebGrid1_OnRowValidate(rowObject) { var WebGrid1 = ISGetObject("WebGrid1"); var rootTable = WebGrid1.RootTable; var currentRowIndex = rowObject.rowIndex; if (rootTable.GetRow(currentRowIndex).GetCells().GetNamedItem("CompanyName").Text == "") return false; else return true; }
Hope this helps.
This doesn't work for my scenario.
I have a button that will add a row to the grid and default data. The user could click this button twice created two rows with default data. The OnRowValidate doesn't fire. I even clicked into the row and went up and down through the two rows and this event didn't fire so no validation occurred.
Hi Shawn, As I mention in the previous post. If the image on TemplatedCell was already pre-defined by the time the Grid was made, it will automatically show the image when you creating rows on the client side.But TemplatedCell can't handle a post-defined image (The Grid already made, then creating rows with inputing an image inside the TemplatedCell). The TemplatedCell ability is to add ASP.NET server controls to the WebGridCell using the new Template Column Type. When using the Template column Type, you can put any server side controls inside the CellTemplate property of the WebGridColumn.If you really want this features. You can go to our TDN http://dev2.intersoftpt.com/. Under Create New Item dockitems, choose Feature Request. You can input any features you need on the next development.Thank you and have a nice day. Best regards,Niven Prasetya.
Hi Shawn,
As I mention in the previous post. If the image on TemplatedCell was already pre-defined by the time the Grid was made, it will automatically show the image when you creating rows on the client side.
But TemplatedCell can't handle a post-defined image (The Grid already made, then creating rows with inputing an image inside the TemplatedCell). The TemplatedCell ability is to add ASP.NET server controls to the WebGridCell using the new Template Column Type. When using the Template column Type, you can put any server side controls inside the CellTemplate property of the WebGridColumn.
If you really want this features. You can go to our TDN http://dev2.intersoftpt.com/. Under Create New Item dockitems, choose Feature Request. You can input any features you need on the next development.
Thank you and have a nice day.
Best regards,
Niven Prasetya.
The CellTemplate is defined within the markup and still does not show up. Was this fixed after WebGrid (7.0.7200.403)? Can you give me a very basic example that you verifies works for you and I will test locally?
Hi Shawn,Like what you said "It is common for many developers to rely on the database to creat the primary key", the grid will need you to describe which column is the primary key using the DataKeyField property. Eventhough it's not a valid data "(Auto)" but we still need to define which column is the primary key through the DataKeyField property.Best Regards,Gordon Tumewu
Like what you said "It is common for many developers to rely on the database to creat the primary key", the grid will need you to describe which column is the primary key using the DataKeyField property.
Eventhough it's not a valid data "(Auto)" but we still need to define which column is the primary key through the DataKeyField property.
I don't understand what you are saying. I understand that the DataKeyField property must be set to the primary key field. I do not why it must be specified each time a row is added. This is a bad design approach because the data is invalid and it indicates the data exists in the database which it does not.
Hi Shawn,Sorry for the late response. Yes, you need to set the DataKeyField. If you tried the sample given by Michael Giger, you will see that he also set the DataKeyField to RootTable. You need to set it also.Best Regards,Gordon Tumewu
Sorry for the late response. Yes, you need to set the DataKeyField. If you tried the sample given by Michael Giger, you will see that he also set the DataKeyField to RootTable. You need to set it also.
I don't understand why this is necessary. It is common for many developers to rely on the database to creat the primary key (typically, an auto increment integer field or a GUID). This is not available on the client-side until the data is committed. That forces the developer to put a random unique number within the DataKeyField to satisfy the WebGrid control. Futhermore, this design is flawed because at first glance it appears the data is an existing record (the PK field is set) and the data isn't valid data (it's just data added to satisfy the WebGrid control).
Also, is there a timeline for this bug to be fixed? The CellTemplate elements should be displayed when creating rows on the client-side.
Hi Shawn,Did you use BatchUpdate? As far as I know, AddPendingChanges is used for BatchUpdate scenario as a trigger when you done with any updates (Add, Update,Delete, etc).If you want to add new row, you can use the code I have given to you.On my sample, I'm not using auto increment for PK. If you want to use an auto increment you can refer to our sample, BatchUpdate_Enterprise. On BatchUpdate_Enterprise sample, there is a SelectIdentityQuery handler (App_Code/dsNorthwind_Extended.cs) which will check what is the latest number and after will be automatically increment.Have a nice day. Best regards,Niven Prasetya.
Did you use BatchUpdate? As far as I know, AddPendingChanges is used for BatchUpdate scenario as a trigger when you done with any updates (Add, Update,Delete, etc).
If you want to add new row, you can use the code I have given to you.
On my sample, I'm not using auto increment for PK. If you want to use an auto increment you can refer to our sample, BatchUpdate_Enterprise. On BatchUpdate_Enterprise sample, there is a SelectIdentityQuery handler (App_Code/dsNorthwind_Extended.cs) which will check what is the latest number and after will be automatically increment.
Have a nice day.
I need to call the row's AddPendingChanges() method to add/update rows using JavaScript in a WebGrid with BatchUpdate turned on. Oddly, I don't need to do call this method when deleting rows as it still ends up in the WebGridRowChanges collection? Also, in my other thread (http://www.intersoftpt.com/Community/WebGrid/How-to-delete-rows-using-BatchUpdate-scenario/), I don't get the new Delete icon after the row's Delete() method is called so I am not sure why the icon doesn't change and why I don't need to call the AddPendingChanges() like adding/updating rows.
When creating a new row, is it necessary to call the row's Update() method after the field's are defaulted? I don't seem to need to do that for creating new rows but for updating rows.
As you can see in my video, It should be appeared when you use batch update mode. There should be nothing like you said. All pending changes should be have flags.Or if you delete the new added row, the row should be dissapeared at once.So, Would you mind just send me your simple runable sample that showed the situation that you described?Regards,Handy
As you can see in my video, It should be appeared when you use batch update mode. There should be nothing like you said. All pending changes should be have flags.Or if you delete the new added row, the row should be dissapeared at once.So, Would you mind just send me your simple runable sample that showed the situation that you described?
Regards,Handy
I am using WebGrid version 7.0.7200.403.
As soon as it calms down, I will get you an example. My current work around is to use CSS to hide the row. The row's Delete() method puts it in the WebGridRowChanges so it is deleted as expected. It is odd that I do not need to call the AddPendingChanges() method like I need to for adding/updating row data using JavaScript.
To be clear, the row's Delete() method doesn't change the row icon as it remains a "+" to indicate a new row. It is also added to the WebGridRowChanges collection as discussed above without having to call the AddPendingChanges() method. I am not sure why the icon doesn't change as shown in your video.
As I said before, it is our default behaviour in BatchUpdate.When you delete, it will also show you some flags. Please see my recording video. I don't understand why you did not notice the different in the UI.It should be easy to see.However, if you want, you can hide it by set display style to none in the element.e.g grid.GetSelectedObject().ToRowObject().GetElement().style.display="none"; Regards,Handy
As I said before, it is our default behaviour in BatchUpdate.When you delete, it will also show you some flags. Please see my recording video. I don't understand why you did not notice the different in the UI.It should be easy to see.
However, if you want, you can hide it by set display style to none in the element.
e.g
grid.GetSelectedObject().ToRowObject().GetElement().style.display="none";
That delete icon isn't visible after the Row is deleted. I am creating rows based on a button click but that shouldn't matter.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname