Hi, I am using UltraWebGrid Version 8.2.20082.1000 on an ASP.NET 3.5 page with UpdatePanel. Grid is set to use LoadOnDemand=Xml and I have implemented the InitializeDataSource event in which the grid is DataBind.
I have a button on the page which fires a server-side event. Steps in codebehind event:
1. Create a new temporary UltraWebGrid (will be used to export grid data)
2. Copy selected rows to temp grid
3. Delete selected rows from the database
4. Delete selected rows from the DisplayLayout
5. Export the temp grid
The rows get deleted properly from the database. The selected rows are exported fine and the user gets a prompt to open/save the exported file. The problem is that the grid on the client-side does not get refreshed after the export. The rows that I deleted are still visible in the grid until the next postback. I tried to call DataBind on the grid before and after the export but it did not help.
Thanks!
I have read your article. It's quite good. There is a free component can do it also. It's quite fast and stable. I have used it for a long time, you can try it. More information:http://www.e-iceblue.com/Introduce/free-dataexport-component.html
Iam using version 9.1 ,Iam trying to export acrobat reader or plain text ,iam getting empty data in pdf and plain text for autogenerate column false,but it's working fine for autogeneratecolumns true
this is my source code
Imports SystemImports System.DataImports System.Data.SqlClient
Partial Class _Default Inherits System.Web.UI.Page Dim cn As New SqlConnection("Data Source=BTA-SQLDB;Initial Catalog=GoogleData;Integrated Security=True")
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dt As New DataTable()
dt = BouncePath() UltraWebGrid2.DataSource = dt
UltraWebGrid2.DataBind()
End Sub Public Function BouncePath() As DataTable
Dim dt As New DataTable() Dim cmd As New SqlCommand("GetBouncePath", cn)
cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@Frdate", DateTime.Now) cmd.Parameters.AddWithValue("@ToDate", DateTime.Now)
Dim adp As New SqlDataAdapter(cmd
adp.Fill(dt)
Return dt End Function
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click UltraWebGridDocumentExporter1.Export(UltraWebGrid2) End SubEnd Class
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register assembly="Infragistics35.WebUI.UltraWebGrid.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebGrid" tagprefix="igtbl" %>
<%@ Register assembly="Infragistics35.WebUI.UltraWebGrid.DocumentExport.v9.1, Version=9.1.20091.1015, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.UltraWebGrid.DocumentExport" tagprefix="igtbldocexp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <div> </div> <igtbl:UltraWebGrid ID="UltraWebGrid2" runat="server" Height="200px" Width="325px"> <bands> <igtbl:UltraGridBand> <addnewrow view="NotSet" visible="NotSet"> </addnewrow> <Columns> <igtbl:TemplatedColumn BaseColumnName="Bounces" Key="Bounces" Width="250px" > <Header Caption="Bounces" Title="Bounces"> </Header> </igtbl:TemplatedColumn> <igtbl:TemplatedColumn BaseColumnName="PagePath" Key="PagePath" Width="250px" > <Header Caption="PagePath" Title="PagePath"><RowLayoutColumnInfo OriginX="1"></RowLayoutColumnInfo> </Header>
<Footer><RowLayoutColumnInfo OriginX="1"></RowLayoutColumnInfo></Footer> </igtbl:TemplatedColumn> </Columns> </igtbl:UltraGridBand> </bands> <displaylayout allowcolsizingdefault="Free" allowcolumnmovingdefault="OnServer" allowdeletedefault="Yes" allowsortingdefault="OnClient" allowupdatedefault="Yes" bordercollapsedefault="Separate" headerclickactiondefault="SortMulti" name="UltraWebGrid2" rowheightdefault="20px" rowselectorsdefault="No" selecttyperowdefault="Extended" stationarymargins="Header" stationarymarginsoutlookgroupby="True" tablelayout="Fixed" version="4.00" viewtype="OutlookGroupBy" AutoGenerateColumns="false" > <framestyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt" height="200px" width="325px"> </framestyle> <pager minimumpagesfordisplay="2"> <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </PagerStyle> </pager> <editcellstyledefault borderstyle="None" borderwidth="0px"> </editcellstyledefault> <footerstyledefault backcolor="LightGray" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </footerstyledefault> <headerstyledefault backcolor="LightGray" borderstyle="Solid" horizontalalign="Left"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </headerstyledefault> <rowstyledefault backcolor="Window" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" font-names="Microsoft Sans Serif" font-size="8.25pt"> <padding left="3px" /> <borderdetails colorleft="Window" colortop="Window" /> </rowstyledefault> <groupbyrowstyledefault backcolor="Control" bordercolor="Window"> </groupbyrowstyledefault> <groupbybox> <boxstyle backcolor="ActiveBorder" bordercolor="Window"> </boxstyle> </groupbybox> <addnewbox hidden="False"> <boxstyle backcolor="Window" bordercolor="InactiveCaption" borderstyle="Solid" borderwidth="1px"> <borderdetails colorleft="White" colortop="White" widthleft="1px" widthtop="1px" /> </boxstyle> </addnewbox> <activationobject bordercolor="" borderwidth=""> </activationobject> <filteroptionsdefault> <filterdropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;" font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px" height="300px" width="200px"> <padding left="2px" /> </filterdropdownstyle> <filterhighlightrowstyle backcolor="#151C55" forecolor="White"> </filterhighlightrowstyle> <filteroperanddropdownstyle backcolor="White" bordercolor="Silver" borderstyle="Solid" borderwidth="1px" customrules="overflow:auto;" font-names="Verdana,Arial,Helvetica,sans-serif" font-size="11px"> <padding left="2px" /> </filteroperanddropdownstyle> </filteroptionsdefault> </displaylayout> </igtbl:UltraWebGrid> <igtbldocexp:UltraWebGridDocumentExporter ID="UltraWebGridDocumentExporter1" runat="server"> </igtbldocexp:UltraWebGridDocumentExporter> <asp:Button ID="Button1" runat="server" Text="Button" /> </form></body></html>
Hello,
Thanks for your reply and sorry that i didnt respond earlier (got working on somthing else and put off the problem.) I will most definately try to implement your solution and let you know if it works.
Thanks!!!!!
That's great to hear, I am glad I was able to help. This btw is a very tough case and is quite common in forums, so I will try to create a complete solution and create a blog post about it - with step by step instructions and sample project installed.
Thanks again.
mbradham12 said: Hello, I actualy have the exact same problem with my grid only I am not creating a temporary grid and I am exporting to Excel not pdf. I am using a checkbox column to select the rows that i want to delete from the database where the data resides. Once the user has selected all of the rows they wish to remove, the code steps through the grid and adds all of the rows that are checked to a list. That list is then passed as a parameter to a stored procedure which then updates the database. At this point, I have the same problem as you, since my grid is inside an update panel, the rows that were deleted are still on the page even after the database has been updated. I have to totally navigate away from the page (to another page in the application) and then return to the page in order to cause a postback and therefore see the updated grid without the rows that I deleted showing up... I was just wondering if you had come across a solution yet or not... Thanks!
I actualy have the exact same problem with my grid only I am not creating a temporary grid and I am exporting to Excel not pdf.
I am using a checkbox column to select the rows that i want to delete from the database where the data resides. Once the user has selected all of the rows they wish to remove, the code steps through the grid and adds all of the rows that are checked to a list. That list is then passed as a parameter to a stored procedure which then updates the database. At this point, I have the same problem as you, since my grid is inside an update panel, the rows that were deleted are still on the page even after the database has been updated. I have to totally navigate away from the page (to another page in the application) and then return to the page in order to cause a postback and therefore see the updated grid without the rows that I deleted showing up...
I was just wondering if you had come across a solution yet or not...
Hello, During the async postback I had to manually remove the deleted rows from the DisplayLayout of the grid. Please refer to Rumen Stankov's solution to trigger the download after the first async postback is finished.