|
Hi All,
How can I Export data from dataset to Excel with print layout. when we see this Excel report in print view the page numbers should be appear in the format of [Page x of y].
Please also suggest me how can I add Header and Footer to that Excel report.
I am very pleased if anybody help me regarding this.
Thanks in advance
karthik
-- modified at 9:20 Thursday 19th April, 2007
|
|
|
|
|
Sub Page_Load(ByVal Sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
Dim SQLconn As New SqlConnection("Server=(local)\SQLExpress;Initial Catalog=Test;Integrated Security=True")
SQLconn.Open()
Dim Query As String = "SELECT rawvalue FROM Device1 WHERE device = 'Channel1'"
Dim SelectCmd As New SqlCommand(Query, SQLconn)
Dim result As Boolean
SQLconn.Open()
Dim myDataReader As SqlDataReader
myDataReader = SelectCmd.ExecuteReader()
result = myDataReader.GetBoolean(0)
SQLconn.Close()
ChangeButton(result)
End If
End Sub
Sub ChangeButton(ByVal Status As Boolean)
If Status Then
OnOff.Text = "Press to Close"
Label1.Text = "ON"
Label1.BackColor = Drawing.Color.Green
Else
OnOff.Text = "Press To Open"
Label1.Text = "OFF"
Label1.BackColor = Drawing.Color.Red
End If
End Sub
I have this code to change some properties of a label and a button. The problem is that I get and error while debbugging this in Visual Web Developer.
The error is:
"The connection was not closed. The connection's current state is open."
The problem is in line 21 "SQLconn.Open()"
Stack Trace:
[InvalidOperationException: The connection was not closed. The connection's current state is open.]
System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +56
System.Data.SqlClient.SqlConnection.Open() +229
ASP.mapurls_p2_aspx.Page_Load(Object Sender, EventArgs e) in C:\Websites\Project\MapUrls\p2.aspx:21
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3034
Thanks!
|
|
|
|
|
You have two calls to Open().
|
|
|
|
|
Yes. Thank you.
I deleted "Handles MyBase.Load" and I don't get the error message now.
The problem now is that I don't get any values in my Button and Label controls.
I mean the Boolean value passes to ChangeButton procedure that should initialize the controls.
QLconn.Open()
Dim myDataReader As SqlDataReader
myDataReader = SelectCmd.ExecuteReader()
myDataReader.Read()
result = myDataReader.GetBoolean(0)
myDataReader.Close()
SQLconn.Close()
ChangeButton(result)
Sub ChangeButton(ByVal Status As Boolean)
If Status Then
OnOff.Text = "Press to Close"
Label1.Text = "ON"
Label1.BackColor = Drawing.Color.Green
Else
OnOff.Text = "Press To Open"
Label1.Text = "OFF"
Label1.BackColor = Drawing.Color.Red
End If
End Sub
|
|
|
|
|
Why would you delete the handle from the event??
The only problem you had was that you were opening the connection twice...
|
|
|
|
|
Man. Thank you again!!!!!!
I'm so stupid and blind. I put the handle and it works perfect.
If you have the time can you please explain me why this handle is needed?
|
|
|
|
|
You can name your page load sub to be whatever you like (as long as it has the right method signature). The handles keyword tells the system which function to fun on page load...
If you want some more info, read up on events within asp.net.
|
|
|
|
|
Another problem.
Now I get the following error: <
|
|
|
|
|
hi friends
i have the image in datalist.If click that picture,picture will enlarge and open in popup window.
can u help me??
regards
saravanan
|
|
|
|
|
hi.
i may not be clear or accurate but its my opninion may be you can try ....
make that image also a hyperlink then to that link keep the image u are loading in data grid with fixed size to display in full size in another page in new page
the img contol to display the full image using fixed path and image name using parameter passed to it.
Rama Charan Prasad
"Be happy and Keep smiling.Thats what u want be always.. "
|
|
|
|
|
hi all,
I have a flash application which needs to send values to the server (here asp.net). Also the response from the server is sent again to flash.
Going through the articles i found that the method,sendandload allows two way communication between flash and asp.net.But the problem is that the values are passed to the asp.net page but the page gets loaded again and again.
Thanks in advance
Regards
Anuradha
|
|
|
|
|
I have an application in Asp.net.In my machine sql server2000 and 2005 instaled.
I want to connect my project with sql server 2005.Suppose DB name is BBN,but problem is that this DB name is also exist in sql server2000.Now Plz tell me how can i connect my project with sql server2005.
Thanks in advance......
Sujit
|
|
|
|
|
add key="forumDSN" value="server=sujit;uid=sa;pwd=sa;database=BBN"
This is my connection string.
Sujit
|
|
|
|
|
add key="forumDSN" value="Data Source=SYSARUN\SQLEXPRESS;Initial Catalog=BBN;uid=sa;pwd=sa;Integrated Security=True"/
Please specify the exact server instance like the bolded test.
|
|
|
|
|
I have placed Dropdownlist along with some other controls in Updatepanel in an asp.net application. But, During Async Postback, Dropdownlist is flickering. Can any one help me in this regard.
VijayKrishna
|
|
|
|
|
Hello friends..
I am beginner in asp.net technology. I want to learn how to use Ajax with asp.net. Please give me useful links with easy explaination
-- modified at 7:32 Thursday 19th April, 2007
|
|
|
|
|
|
|
yeah u r right.
its "http://ajax.asp.net"
sorry yaar.
ne ways
|
|
|
|
|
|
Hi All!!!
I´d like to know if somebody can give any idea, cause I don't know what else to do:
Scenario:
ASP.NET GridView, linked to a Customer Object (public/private properies) through a ObjectdataSource
The Thing is that when I am doing the Update of the Grid, the Object Customer arrives with all the data to the BLL, but when I am clicking in the Delete one, the object arrives empty to the BLL.
I have debuged it, and in the "Deleting Event" of the Grid, the values for the parameters are there, but in the "Deleting Event" of the Object DataSource the values dissapear...
Can anybody give any ideas
Thanks and Regards
Ricardo Casquete
|
|
|
|
|
Each time you post back to the web server you most likely need to bind your Grid back to the datasource. I would guess you left this out when you are doing a delete. So after you do your delete logic you would need to do another objectdatasource.select and gridview.databind or datagrid.databind.
Hope that helps.
Ben
|
|
|
|
|
Thanks Man...
But I don't think the problem is there (I tried it now), because I can "Update", when I click in the Update Button, the the BLL the object arrives with all the new properties modified, the problem is when clicking in the Delete arrives Empty.
If I debug the the page, when the deleting event of the grid is fired I can see in the "e" var the properties and I can see how the .net creates using Activate the BLL Object. But the properties are not being assigned.
In the update event I also debug the point where the properties are assinged...
Ricardo Casquete
|
|
|
|
|
Because I was creating the GridView columns at runtime based on the schema of the Business Entity, because of that I forgot assing the DataKey property
Ricardo Casquete
|
|
|
|
|
I have one string "Show All Products" I want to seperate that string into "Show" "All" "Products".
Thanks
................
|
|
|
|