This is a migrated thread and some comments may be shown as answers.

Export and Update issue

1 Answer 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CarlosCisneros
Top achievements
Rank 1
CarlosCisneros asked on 22 Sep 2008, 04:31 PM
Hi

I need assistance i'm trying to export from a radgrid but also i need to make an update after export, but seems that doesnt work no matter where i put the update radgrid exports the same query with no results on it.

let me give you more details i have a table and one column is exported wich can have 2 values "0" for not exported and "1" for items exported.

on my web page i can filter for date (start and end date) and i can include exported items, wich gives me 8 possible combinations. No matter wich select i use i want to export to excel items on grid using a button and also want to update items to make column exported value from 0 to 1

do you have any idea why i cant do this?

here is my button code.

protected void BTN_Exportar_SAP_Click(object sender, EventArgs e)
    {
        Lerror.Text = "";
        RadGrid2.ExportSettings.FileName = "Proveedores(Formato SAP)";
        RadGrid2.ExportSettings.ExportOnlyData = true;
        RadGrid2.ExportSettings.IgnorePaging = false;
        RadGrid2.ExportSettings.OpenInNewWindow = true;
        SqlDataSource1.SelectCommand = Session["Query"].ToString();
        RadGrid2.Visible = true;       
        RadGrid2.Rebind();
        RadGrid2.MasterTableView.ExportToExcel();
        Session["DoUpdate"] = "1";
        SqlDataSource1.UpdateCommand = Session["Update"].ToString();
        SqlDataSource1.Update();
}

thanks in advanced.

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 25 Sep 2008, 10:29 AM
Hello Carlos,

Basically, there is no straightforward solution in this case. When the grid is exported, the response is cleared, and a new browser window is opened, to receive the output. There are no other events on the original page. Another option which you may consider is first updating the database, and then exporting the control.
I hope this information helps.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
CarlosCisneros
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or