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
I've added a checkbox column to my webgrid in server-side code:
wgCol.DataType = "System.String"
wgCol.ColumnType = ColumnType.CheckBox
WebGrid1.RootTable.Columns.Add(wgCol)
I set the value to True in the WebGrid1_InitializeRow event:
When the Page finishes loading, the checkbox is checked, however, when I test the value in an UpdateRow event it returns Nothing.
Any help would be greatly appreciated.
Conrad
Sorry for the late respond.
The idea is to create bound columns that really represent the checkbox data.
So let’s say if you are using data table, then you can add three new boolean columns to the data table. And then assign the data manually to it.
So you can bind to WebGrid directly as bound column. During update, you can collect the data in UpdateRow event and then call the database method to perform the additional backend operation.
Hope this help.
The checkbox value will returns nothing (null) in UpdateRow event because this event is too early. UpdateRow event will come first before InitializeRow event.
Could you please let us know what your scenario is, so that we can assist you to provide workaround for your scenario?
Yudi,
I apologize for not providing the full scenario.
I have a WebGrid that I bind to a datasource on the server side. The user defines how many "loads" they want their order delivered in and I dynamically add that many columns to the grid in the Page_Load server side event. The user then splits their order by checking the appropriate boxes and I save that data via a server side UpdateRow and a stored procedure because that data is stored in a table that is different from the original datasource. If the user returns to this page, I need to display what they previously selected, so I select the data from the database in the InitializeRow server side event and set the checkboxes. The page is displayed correctly with the boxes checked, however, if they check a new box and save that data, the original checked boxes return nothing instead of true. I hope this helps.
Thanks,
In order to retrieve the checkbox value in UpdateRow event, I suggest you to use bound checkbox column. Using checkbox as the column edit type in unbound mode will not do the trick, since the value will not be transferred because the column is unbound.
Unfortunately it doesn't. The checkbox can't be bound because the number of checkboxes in dynamic. Is there another way to accomplish this?
Is it possible to implement IsRowChecker feature for your scenario?
When a column has its IsRowChecker property set to True, a few other properties will be automatically configured such as Width to 25px, ColumnType to Checkbox, SelectColumns to No, and so on. The “select/deselect” all checkbox in column Caption is automatically generated for IsRowChecker column. The code for select/deselect all functionality has also been written internally and so you do not have to do anything else, just focus on your business logic.
In server side event, you can get the rows that being checked by invoking ‘GetCheckedRows()’ method. The method returns ArrayList type value that contains the keyValue of the selected/checked rows.
ArrayList checkedRows = WebGrid1.RootTable.GetCheckedRows();
*If you don’t mind, could you please send us the screenshot of your WebGrid so that I can have clearer view of your requirement?
Here is a screenshot and the code for the page in question. I've included the calling page also.
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