Showing posts with label visible. Show all posts
Showing posts with label visible. Show all posts

Saturday, March 31, 2012

server side control not visible in webpage

Hey there-
I have a newbie question regarding code behind:
Using inline code, I can run a simple page that binds data to a
datagrid. Now, I try to take the same code and use code behind, and
the page compiles fine, but no HTML is rendered to the page.
Here is the code from "WebForm1.aspx"
<%@dotnet.itags.org. Page Language="vb" Inherits="WebForm1" src="http://pics.10026.com/?src=WebForm1.aspx.vb" %>
<html>
<head>
<title>WebForm1</title>
</head>
<body>
<asp:datagrid id="datGrid" runat="server"/>
</body>
</html>
--
And here is the code for "WebForm1.aspx.vb"
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
BindData()
End Sub
Sub BindData()
'1. Create a connection
Dim AccessConn As System.Data.OleDb.OleDbConnection
Dim AccessCommand As System.Data.OleDb.OleDbCommand
Dim AccessReader As System.Data.OleDb.OleDbDataReader
Dim strConn As String
Dim datGrid As New DataGrid
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\inetpub\wwwroot\AddressBook\da
tabase\Address.mdb;"
AccessConn = New System.Data.OleDb.OleDbConnection(strConn)
'2. Create the command object, passing in the SQL string
Const strSQL As String = "SELECT ID, LastName, FirstName FROM
tblAddress ORDER BY LastName"
Dim myCommand As New System.Data.OleDb.OleDbCommand(strSQL,
AccessConn)
'Set the datagrid's datasource to the datareader and databind
AccessConn.Open()
datGrid.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
datGrid.DataBind()
End Sub
End Class
--
A couple of notes:
1) I removed the "Web Form Designer Generated Code" for simplicity
2) Why do I need to declare datGrid? None of the examples I have seen
don't declare the server controls.
Regards,
ChristianChristian,

> 1) I removed the "Web Form Designer Generated Code" for simplicity
Don't do that! JK! I would suggest trying your example with the web form des
igner code cause your datagrid object is initialized in there. Also make sur
e your query is returning rows.
-Calvin Luttrell
ProjectThunder.com
Calvin-
I didn't remove the code from the actual aspx file, just in the
example here. My query is returning rows. Like I mentioned in the
previous post, everything works great if I use inline code, it's when
I modify it to code behind that the control doesn't render.
Christian
"Calvin Luttrell/ProjectThunder.com" <calvinl@.projectthunder.com> wrote in message news:<Ov
6WqlUQEHA.2520@.TK2MSFTNGP11.phx.gbl>...
> Christian,
>
> Don't do that! JK! I would suggest trying your example with the web form
> designer code cause your datagrid object is initialized in there. Also
> make sure your query is returning rows.
>
> -Calvin Luttrell
> ProjectThunder.com
>
>
>
>
> --

server side control not visible in webpage

Hey there-

I have a newbie question regarding code behind:

Using inline code, I can run a simple page that binds data to a
datagrid. Now, I try to take the same code and use code behind, and
the page compiles fine, but no HTML is rendered to the page.

Here is the code from "WebForm1.aspx"

------
<%@dotnet.itags.org. Page Language="vb" Inherits="WebForm1" src="http://pics.10026.com/?src=WebForm1.aspx.vb" %>
<html>
<head>
<title>WebForm1</title>
</head>
<body
<asp:datagrid id="datGrid" runat="server"/
</body>
</html>
-------

And here is the code for "WebForm1.aspx.vb"

-------
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data

Public Class WebForm1
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
BindData()
End Sub

Sub BindData()

'1. Create a connection
Dim AccessConn As System.Data.OleDb.OleDbConnection
Dim AccessCommand As System.Data.OleDb.OleDbCommand
Dim AccessReader As System.Data.OleDb.OleDbDataReader
Dim strConn As String
Dim datGrid As New DataGrid

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\inetpub\wwwroot\AddressBook\database\Add ress.mdb;"
AccessConn = New System.Data.OleDb.OleDbConnection(strConn)

'2. Create the command object, passing in the SQL string
Const strSQL As String = "SELECT ID, LastName, FirstName FROM
tblAddress ORDER BY LastName"
Dim myCommand As New System.Data.OleDb.OleDbCommand(strSQL,
AccessConn)

'Set the datagrid's datasource to the datareader and databind
AccessConn.Open()
datGrid.DataSource =
myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
datGrid.DataBind()
End Sub

End Class
-------

A couple of notes:

1) I removed the "Web Form Designer Generated Code" for simplicity
2) Why do I need to declare datGrid? None of the examples I have seen
don't declare the server controls.

Regards,

ChristianChristian,

> 1) I removed the "Web Form Designer Generated Code" for simplicity

Don't do that! JK! I would suggest trying your example with the web form designer code cause your datagrid object is initialized in there. Also make sure your query is returning rows.

-Calvin Luttrell
ProjectThunder.com


Calvin-

I didn't remove the code from the actual aspx file, just in the
example here. My query is returning rows. Like I mentioned in the
previous post, everything works great if I use inline code, it's when
I modify it to code behind that the control doesn't render.

Christian

"Calvin Luttrell/ProjectThunder.com" <calvinl@.projectthunder.com> wrote in message news:<Ov6WqlUQEHA.2520@.TK2MSFTNGP11.phx.gbl>...
> Christian,
> > 1) I removed the "Web Form Designer Generated Code" for simplicity
> Don't do that! JK! I would suggest trying your example with the web form
> designer code cause your datagrid object is initialized in there. Also
> make sure your query is returning rows.
>
> -Calvin Luttrell
> ProjectThunder.com
>
>
>
>
> --

Server side controls not visible!

I have an ASP.Net application. I first tested it by using my machine as a local host and it was working fine. My problems started the moment I posted my application on a web server.

1. Firstly all the controls (like buttons, labels) do not show up when I run the application on the web server

2. Secondly, I was wondering if I had to change something in the web.config file to make my application run.

Any help would be appreciated.

ThanksTry running

aspnet_regiis -i

From the start|Run on your server machine.

This should fix the problem.
you got that memorized too scostell? :p
sure do...when something as simple as that can fix a problem that drove me nuts for 3 days...you don't forget it! hahaha:D

Saturday, March 24, 2012

Server.CreateObject: Making objects visible

I would like to make an DCOM-object created by an ASP page visible for debugging purposes.
For instance: I have the following code:

SET objExcel = Server.CreateObject("Excel.Application.10")
objExcel.Application.Visible = True
SET Session.Contents("myexcel") = objExcel

When I run this code, the Excel object is created and stored in a session variable for later use. However, on my machine it is not visible, although I have set the visible property to True.
I can see that the EXCEL object was created by opening in the process page of the WINDOWS Task-Manager
I tried also to Server.CreateObject several other objects with the same result: Although I have set the visible property to true they just do not show up.
What me make wondering about this is that a couple a weeks ago everything worked fine, the Server.Created objects were visible, but I must have changed something on my machine because now they remain invisible.
Does anybody has a clue on this?Just found the solution:
in the DCOM-Configuration the identity must be Interactive User (NOT user who started the application)
Already thought this was a Windows Privileges problem
I've been having the same problem - getting Excel to become visible. How do you configure the identity to be Interactive User? Is it in the dcomcnfg utility?

When I run my app, I can see EXCEL.EXE in my task manager, but it is not visible and I, too, use the visible=true setting.

It's been plaguing me for about a week now.
I'm a bit new, so go easy....

Rykri11
Yes with Windows 2000 you'll have to run dcomcnfg.exe while with WindowsXP you'll also find it at computer administration (component services)
Then you need to find your application (MS Excel) and edit the properties of this application (right-mouse click with XP, push-button with Windows 2000). On the 4th page named "identity" of the page selector you'll need to set the user to "interactive user"