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
Hi
When I try to export data from a WebGrid that it's datasource is a datatable in code behind, it appears the screen that is in atachment.
If I try to export data from a WebGrid whith an aspdatasource (like in demo example), it works.
Can you please, say to me how can I fixed this problem?
Thank you
All codes related to the assignment of data source to the WebGrid component should be place in InitializeDataSource server side event of WebGrid. Avoid assigning the DataSource property to the Grid object such as WebGrid2.DataSource = tabla2, since in the InitializeDataSource event, developers could obtain an object of DataSourceEventArgs here using e.
Please replace WebGrid2.DataSource = tabla2 with e.DataSource = tabla2. The code listing should looks like below.
Protected Sub Samplegrid_InitializeDataSource(ByVal sender As Object, ByVal e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Handles WebGrid1.InitializeDataSource ... Funciones.AddColPromedio(tabla2, 1, 2, Total) e.DataSource = tabla2 WebGrid2.DataBind() End Sub
This should helps. Please let us know if the problem still persists.
Could you please inform me about how did you bind the DataTable (as the data source of WebGrid) in code behind? Currently I suspect that the data binding process might be located in Page_Load event instead of the InitializeDataSource event of WebGrid.
Look forward to hearing back from you so that we can assist you further.
Thank you for the reply.
I was doing the data binding process in de Page_Load event. I change this to the InitializeDataSource event and the error screen change. Now is the attachment file.
Protected Sub WebGrid2_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Handles WebGrid2.InitializeDataSource Dim Consultas As New Consultas Dim Acceso As New AccesoDatos Dim Funciones As New Funciones Dim tabla As New DataTable 'tabla = Consultas.ConsultaCategorias() 'Dim Total As Int32 = Funciones.SumarGrid(tabla, "Clientes") 'Funciones.AddColPromedio(tabla, 1, 2, Total) 'Funciones.AddColCodigo(tabla) 'WebGrid1.DataSource = tabla 'WebGrid1.DataBind() Dim tabla2 As New DataTable tabla2 = Consultas.ConsultaDuraciones() Dim Total As Int32 = Funciones.SumarGrid(tabla2, "Clientes") Funciones.AddColPromedio(tabla2, 1, 2, Total) WebGrid2.DataSource = tabla2 WebGrid2.DataBind() End Sub
This is the code behind.
It Works!!!
Thank You very much.
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