Click here to Skip to main content
15,917,610 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Code analysis Pin
Paul Conrad15-Jul-07 4:59
professionalPaul Conrad15-Jul-07 4:59 
AnswerRe: Code analysis Pin
Mohammed Hameed15-Jul-07 8:21
professionalMohammed Hameed15-Jul-07 8:21 
QuestionControls are not displaying after hosting the Page Pin
Kurian_Kurian14-Jul-07 14:23
Kurian_Kurian14-Jul-07 14:23 
AnswerRe: Controls are not displaying after hosting the Page Pin
Manas Bhardwaj14-Jul-07 22:36
professionalManas Bhardwaj14-Jul-07 22:36 
AnswerRe: Controls are not displaying after hosting the Page Pin
Guffa14-Jul-07 23:02
Guffa14-Jul-07 23:02 
GeneralRe: Controls are not displaying after hosting the Page Pin
Kurian_Kurian14-Jul-07 23:29
Kurian_Kurian14-Jul-07 23:29 
AnswerRe: Controls are not displaying after hosting the Page Pin
Guffa15-Jul-07 0:34
Guffa15-Jul-07 0:34 
GeneralRe: Controls are not displaying after hosting the Page Pin
Sonia Gupta15-Jul-07 0:58
Sonia Gupta15-Jul-07 0:58 
Hi Guffa,
i am using the following code to export dataset data to excel in asp.net

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not Page.IsPostBack) Then
Dim con As New OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=C:\Documents and Settings\Administrator\Desktop\a.mdb")
con.Open()
Dim ds As New Data.DataSet
Dim ad As New OleDbDataAdapter("select * from a", con)
ad.Fill(ds)
GridView1.DataSource = ds
GridView1.DataBind()
End If
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = ""

'// If you want the option to open the Excel file without saving then
'// comment out the line below
'// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls"
Dim stringWrite As System.IO.StringWriter = New System.IO.StringWriter()
Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
GridView1.RenderControl(htmlWrite)
Response.Write(stringWrite.ToString())
Response.End()

End Sub

there is occuring an error
Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server.
but the control is under the form tag with runat server

Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
GeneralRe: Controls are not displaying after hosting the Page Pin
Guffa15-Jul-07 15:15
Guffa15-Jul-07 15:15 
GeneralRe: Controls are not displaying after hosting the Page Pin
Sonia Gupta15-Jul-07 19:05
Sonia Gupta15-Jul-07 19:05 
QuestionRequire help getting started s'il vous plait! Pin
gvanto14-Jul-07 14:20
gvanto14-Jul-07 14:20 
AnswerRe: Require help getting started s'il vous plait! Pin
just3ala215-Jul-07 6:07
just3ala215-Jul-07 6:07 
GeneralRe: Require help getting started s'il vous plait! Pin
Pete O'Hanlon15-Jul-07 10:01
mvePete O'Hanlon15-Jul-07 10:01 
GeneralRe: Require help getting started s'il vous plait! Pin
just3ala215-Jul-07 21:20
just3ala215-Jul-07 21:20 
AnswerRe: Require help getting started s'il vous plait! Pin
Pete O'Hanlon15-Jul-07 10:21
mvePete O'Hanlon15-Jul-07 10:21 
AnswerRe: Require help getting started s'il vous plait! Pin
neerubee15-Jul-07 19:37
neerubee15-Jul-07 19:37 
QuestionContentPlaceHolder Class Pin
Brendan Vogt14-Jul-07 12:45
Brendan Vogt14-Jul-07 12:45 
AnswerRe: ContentPlaceHolder Class Pin
Guffa14-Jul-07 12:57
Guffa14-Jul-07 12:57 
Questionhttp to https Pin
aditya.net14-Jul-07 9:10
aditya.net14-Jul-07 9:10 
AnswerRe: http to https Pin
Paul Conrad14-Jul-07 10:27
professionalPaul Conrad14-Jul-07 10:27 
GeneralRe: http to https Pin
aditya.net14-Jul-07 14:33
aditya.net14-Jul-07 14:33 
GeneralRe: http to https Pin
Paul Conrad14-Jul-07 14:58
professionalPaul Conrad14-Jul-07 14:58 
GeneralRe: http to https Pin
aditya.net14-Jul-07 15:32
aditya.net14-Jul-07 15:32 
GeneralRe: http to https Pin
Manas Bhardwaj14-Jul-07 22:40
professionalManas Bhardwaj14-Jul-07 22:40 
AnswerRe: http to https Pin
neerubee15-Jul-07 19:43
neerubee15-Jul-07 19:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.