Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

convrt datagird to excel

[es] :: .NET :: convrt datagird to excel

[ Pregleda: 2279 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

mii
Marko Markovic
podgorica

Član broj: 54936
Poruke: 102
195.66.163.*



Profil

icon convrt datagird to excel01.10.2007. u 15:04 - pre 201 meseci
Pozdrav svima!

treba da prebacim sadrzinu datagrida u excel, i to mi radi ok,medjutim kada imam drugi datagrid sa linkbutton edit , update,cancel onda ne mogu da prebacim u excel,kaze:
Control 'DataGrid1_ctl02_ctl01' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server.

evo koda:


public void AddAuthor_Click1(Object sender, EventArgs E) {
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");

Response.Charset = "";

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.ContentType = "application/vnd.xls";

System.IO.StringWriter stringWrite = new System.IO.StringWriter();

System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

DataGrid1.RenderControl(htmlWrite);////ovdje javlja gresku!!!!

Response.Write(stringWrite.ToString());

Response.End();



}


Hvala unaprijed!
 
Odgovor na temu

MarkoBalkan

Član broj: 141124
Poruke: 1624
*.adsl.net.t-com.hr.



+19 Profil

icon Re: convrt datagird to excel02.10.2007. u 19:52 - pre 201 meseci
Citat:
mii: Pozdrav svima!

treba da prebacim sadrzinu datagrida u excel, i to mi radi ok,medjutim kada imam drugi datagrid sa linkbutton edit , update,cancel onda ne mogu da prebacim u excel,kaze:
Control 'DataGrid1_ctl02_ctl01' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server.

evo koda:


public void AddAuthor_Click1(Object sender, EventArgs E) {
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");

Response.Charset = "";

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.ContentType = "application/vnd.xls";

System.IO.StringWriter stringWrite = new System.IO.StringWriter();

System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

DataGrid1.RenderControl(htmlWrite);////ovdje javlja gresku!!!!

Response.Write(stringWrite.ToString());

Response.End();



}


Hvala unaprijed!



zašto to jednostavno nisi ubacio u excel?
napišeš mali programčić koji ti exporta u excell.
tj. sve se svodi na čitanje i umetanje podataka, red po red.
 
Odgovor na temu

bgd2500

Član broj: 55912
Poruke: 226
*.finsoft.co.yu.



+7 Profil

icon Re: convrt datagird to excel03.10.2007. u 14:39 - pre 201 meseci
Probaj da predefinises VerifyRenderingInServerForm metod, ovako:
Code:

public override void VerifyRenderingInServerForm(Control control) {}
 
Odgovor na temu

[es] :: .NET :: convrt datagird to excel

[ Pregleda: 2279 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.