既存のグリッドビューをDevexpressASPXGridViewに変換せずに、Devexpress ASPXGridViewExporterツールを使用してAsp.netグリッドビューをPDF形式またはその他の形式に変換する方法はありますか?
3054 次
1 に答える
3
それは可能ですが、エクスポートするには、ラウンドアバウト方式を使用する必要があります。
まず、datasourceID
ASPグリッドビューにバインドしているものを用意する必要があります。エクスポートの手順に従うことができます。次のコードは、エクスポートボタンクリックで記述する必要があります。
ASPxGridView grd = new ASPxGridView(); //create instance of aspxgridview
grd.AutoGenerateColumns = true; //this should be set true so that automatically data gets bind
grd.ID = "Test"; //give any id
grd.DataSource = objs; //Datasource Id - could be objectdatasource
grd.KeyFieldName = "TestField"; //keyfield name in the datasource
this.Controls.Add(grd);
grd.DataBind();
ASPxGridViewExporter1.GridViewID = "Test";
ASPxGridViewExporter1.WritePdfToResponse();
this.Controls.Remove(grd); //would remove the temporarily created instance of devex grid
于 2012-10-24T15:55:53.500 に答える