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 have a 2 column table and I need to be able to autonumber rows as they are added to the grid. I need to do this on the client-side so that the rownumbers are visible to the user. Anybody have any ingenious ways to do this?
Thanks,
Conrad
If you wish to do it in the client side, my suggestion is to use the WebGrid initialize event handler to set the row position property of each row to the RowNumber cell. Here is the snippet for such scenario, in this case the RownNumber cell is the first column in the WebGrid:
function WebGrid1_OnInitialize() { var grid = ISGetObject("WebGrid1"); var rows = grid.RootTable.GetElement(WG40.BODY, WG40.HTMLTABLE).getElementsByTagName("tr"); for (var i = 0; i < rows.length; i++) { rows[i].getElementsByTagName("td")[1].innerText = grid.GetRowByElement(rows[i]).Position + 1; }}
On the other hand, the method will be similar for server side as well, however you will need to use the InitializeRow event handler:
protected void WebGrid1_InitializeRow(object sender, ISNet.WebUI.WebGrid.RowEventArgs e){ if (e.Row.Type == ISNet.WebUI.WebGrid.RowType.Record) { e.Row.Cells[0].Value = e.Row.Position + 1; e.Row.Cells[0].Text = (e.Row.Position + 1).ToString(); }}
I spoke to soon. I forgot to disable my trigger and it was supplying the data. The InitializeRow event is writing the row number to the grid, but not setting the bind variable for the Insert, thus it fails with a cannot insert null.
Here is my datasource:
</SqlDataSource>
Is there another way to accomplish this? Should my parameter name be assigned differently?
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