473,799 Members | 2,822 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

position of user control on a asp.net page

I am using the page_load event to load a user control within a place holder
control and display it on a page. Then I use response.write statements to
loop through the rows of a data table and display the contents on the page.
However, the contents of the table always appear above the user control
instead of being below the control. How can I place the contents of the tabe
below the place holder. See sample code below:

sub page_load(sourc e as object, e as eventargs) Handles MyBase.Load
plcheadbanner.C ontrols.Add(Loa dControl("MainB anner.a Dim
ds As New DataSet()
Dim myconn As String =
ConfigurationSe ttings.AppSetti ngs.Item("Conne ctionString")
Dim cnn As OleDbConnection
Dim stremail
stremail = Session("Emaili d")
cnn = New OleDbConnection (myconn)
Dim dp As New OleDbDataAdapte r("Select * from [project
permissions] where email = '" & stremail & "'", cnn)
cnn.Open()
Dim userinfotb As DataTable
Dim loop1, numrows As Integer
dp.Fill(ds)
userinfotb = New DataTable()
userinfotb = ds.Tables(0)
numrows = userinfotb.Rows .Count
If numrows = 0 Then
Response.Write( "<p>There are NO Projects assigned to
you at this moment</p>")
Else
For loop1 = 0 To numrows - 1
Response.Write( (userinfotb.Row s(loop1).Item(" project
ID")) & "<br>")
Next loop1
End If
cnn.Close()
End Sub
Nov 19 '05 #1
4 1215
Response.Write is not OOP.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"sagars76" <sa******@discu ssions.microsof t.com> wrote in message
news:DF******** *************** ***********@mic rosoft.com...
I am using the page_load event to load a user control within a place holder
control and display it on a page. Then I use response.write statements to
loop through the rows of a data table and display the contents on the
page.
However, the contents of the table always appear above the user control
instead of being below the control. How can I place the contents of the
tabe
below the place holder. See sample code below:

sub page_load(sourc e as object, e as eventargs) Handles MyBase.Load
plcheadbanner.C ontrols.Add(Loa dControl("MainB anner.a Dim
ds As New DataSet()
Dim myconn As String =
ConfigurationSe ttings.AppSetti ngs.Item("Conne ctionString")
Dim cnn As OleDbConnection
Dim stremail
stremail = Session("Emaili d")
cnn = New OleDbConnection (myconn)
Dim dp As New OleDbDataAdapte r("Select * from [project
permissions] where email = '" & stremail & "'", cnn)
cnn.Open()
Dim userinfotb As DataTable
Dim loop1, numrows As Integer
dp.Fill(ds)
userinfotb = New DataTable()
userinfotb = ds.Tables(0)
numrows = userinfotb.Rows .Count
If numrows = 0 Then
Response.Write( "<p>There are NO Projects assigned to
you at this moment</p>")
Else
For loop1 = 0 To numrows - 1
Response.Write( (userinfotb.Row s(loop1).Item(" project
ID")) & "<br>")
Next loop1
End If
cnn.Close()
End Sub

Nov 19 '05 #2
Dont use response.write. You could save your message in a string variable
or stringbuilder vairable, then write the contents to a Literal Control or
Label that you have positioned on your .aspx page.

"sagars76" <sa******@discu ssions.microsof t.com> wrote in message
news:DF******** *************** ***********@mic rosoft.com...
I am using the page_load event to load a user control within a place holder
control and display it on a page. Then I use response.write statements to
loop through the rows of a data table and display the contents on the
page.
However, the contents of the table always appear above the user control
instead of being below the control. How can I place the contents of the
tabe
below the place holder. See sample code below:

sub page_load(sourc e as object, e as eventargs) Handles MyBase.Load
plcheadbanner.C ontrols.Add(Loa dControl("MainB anner.a Dim
ds As New DataSet()
Dim myconn As String =
ConfigurationSe ttings.AppSetti ngs.Item("Conne ctionString")
Dim cnn As OleDbConnection
Dim stremail
stremail = Session("Emaili d")
cnn = New OleDbConnection (myconn)
Dim dp As New OleDbDataAdapte r("Select * from [project
permissions] where email = '" & stremail & "'", cnn)
cnn.Open()
Dim userinfotb As DataTable
Dim loop1, numrows As Integer
dp.Fill(ds)
userinfotb = New DataTable()
userinfotb = ds.Tables(0)
numrows = userinfotb.Rows .Count
If numrows = 0 Then
Response.Write( "<p>There are NO Projects assigned to
you at this moment</p>")
Else
For loop1 = 0 To numrows - 1
Response.Write( (userinfotb.Row s(loop1).Item(" project
ID")) & "<br>")
Next loop1
End If
cnn.Close()
End Sub

Nov 19 '05 #3
Can you please recommend then what should be used instead of response.write

"Kevin Spencer" wrote:
Response.Write is not OOP.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"sagars76" <sa******@discu ssions.microsof t.com> wrote in message
news:DF******** *************** ***********@mic rosoft.com...
I am using the page_load event to load a user control within a place holder
control and display it on a page. Then I use response.write statements to
loop through the rows of a data table and display the contents on the
page.
However, the contents of the table always appear above the user control
instead of being below the control. How can I place the contents of the
tabe
below the place holder. See sample code below:

sub page_load(sourc e as object, e as eventargs) Handles MyBase.Load
plcheadbanner.C ontrols.Add(Loa dControl("MainB anner.a Dim
ds As New DataSet()
Dim myconn As String =
ConfigurationSe ttings.AppSetti ngs.Item("Conne ctionString")
Dim cnn As OleDbConnection
Dim stremail
stremail = Session("Emaili d")
cnn = New OleDbConnection (myconn)
Dim dp As New OleDbDataAdapte r("Select * from [project
permissions] where email = '" & stremail & "'", cnn)
cnn.Open()
Dim userinfotb As DataTable
Dim loop1, numrows As Integer
dp.Fill(ds)
userinfotb = New DataTable()
userinfotb = ds.Tables(0)
numrows = userinfotb.Rows .Count
If numrows = 0 Then
Response.Write( "<p>There are NO Projects assigned to
you at this moment</p>")
Else
For loop1 = 0 To numrows - 1
Response.Write( (userinfotb.Row s(loop1).Item(" project
ID")) & "<br>")
Next loop1
End If
cnn.Close()
End Sub


Nov 19 '05 #4
Use something like a datagrid bound to your dataset

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"sagars76" <sa******@discu ssions.microsof t.com> wrote in message
news:74******** *************** ***********@mic rosoft.com...
Can you please recommend then what should be used instead of response.write
"Kevin Spencer" wrote:
Response.Write is not OOP.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"sagars76" <sa******@discu ssions.microsof t.com> wrote in message
news:DF******** *************** ***********@mic rosoft.com...
I am using the page_load event to load a user control within a place holder control and display it on a page. Then I use response.write statements to loop through the rows of a data table and display the contents on the
page.
However, the contents of the table always appear above the user control instead of being below the control. How can I place the contents of the tabe
below the place holder. See sample code below:

sub page_load(sourc e as object, e as eventargs) Handles MyBase.Load
plcheadbanner.C ontrols.Add(Loa dControl("MainB anner.a Dim
ds As New DataSet()
Dim myconn As String =
ConfigurationSe ttings.AppSetti ngs.Item("Conne ctionString")
Dim cnn As OleDbConnection
Dim stremail
stremail = Session("Emaili d")
cnn = New OleDbConnection (myconn)
Dim dp As New OleDbDataAdapte r("Select * from [project
permissions] where email = '" & stremail & "'", cnn)
cnn.Open()
Dim userinfotb As DataTable
Dim loop1, numrows As Integer
dp.Fill(ds)
userinfotb = New DataTable()
userinfotb = ds.Tables(0)
numrows = userinfotb.Rows .Count
If numrows = 0 Then
Response.Write( "<p>There are NO Projects assigned to you at this moment</p>")
Else
For loop1 = 0 To numrows - 1
Response.Write( (userinfotb.Row s(loop1).Item(" project ID")) & "<br>")
Next loop1
End If
cnn.Close()
End Sub


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7990
by: Doc | last post by:
I've read in a couple of different places including the archives of this forum that html doesn't allow you to precisely dictate the position of an image, but I found this command (again in the archives of this forum) that apparently allows you to do exactly that. <img src="whateveryourfilelocationis" style="position:absolute; left:Xpx; top:Xpx"> What do you call this command? The responder of the particular message where I found it...
3
6279
by: Gav | last post by:
Hi all, I have created a user control and I am using Response.Write in the control to 'write' exactly what I want although it always goes to the top of the page (above <HTML><HEAD> etc). Can I get it so that it writes it where the control is on the page? ie <html>
1
2950
by: dale zhang | last post by:
Hi, I have a web form page. it has gridlayout and a table at top like a template. When I have the literal or requiredfieldvalidator ErrorMsg displayed, they are all over the page. Is there any way to control their locations? Thanks. -dale PS: The html code is below:
0
1630
by: Christian | last post by:
Hi, I try to change the position of a WebUserControl on my WEbform (layout is set to GridLayout) by changing the absolute position in the html-code but it does not work. When I change the position at design-time for my user control by changing it directly in html-code is the change reflected in the design view (and vice-versa). But when I run the app is the control always positioned at the same location (somewhere topleft on the page)
3
6452
by: moondaddy | last post by:
I'm trying to create my first user control and its function is to replace the use of a frames page. I want to position it under the pages header menus and to the right of the pages contents menus. How can I set the top and left position of this control? -- moondaddy@nospam.com
5
15979
by: JezB | last post by:
There are a few references on the net about how to restore a page's scroll position over a postback. This is a simple one which works for me: eg. http://www.devhood.com/messages/message_view-2.aspx?thread_id=104625 My question is : can the same thing be done to restore the scroll position of a specific DIV within a page? I have a DIV section which scrolls independently to the page : <div style="vertical-align: top; height:200px;...
1
4766
by: Leo | last post by:
I created a user control which is some text contained in a HtmlTable. I put this control into main form. I would like to have the ability to move this control around in the main form. I think one way to do this is to change the style of this control at runtime ("Left:xx px; Top:xx px"). Another way is to move the HtmlTable in the control (i.e. change the style of it). However I couldn't figure out how to let it work. At design time, I...
6
2512
by: Jorge Luzarraga Castro | last post by:
Hey, hope you can help with this. I have an aspx page which contains several User Control. At the beggining there´s only one visible User Control but after working with the page additional UC begin showing up which means the page gets longer so the scroll bar is needed to reach the ones at the bottom. The problem I have is that when I´m working with the user control at the bottom of the page and this page needs to be reloaded the...
1
1789
by: Rob R. Ainscough | last post by:
I'm at a new level of frustration just trying to get my controls to line up and stay in place. I'm using a MultiView containing 4 views - some views have Panels. I can't use absolution position on my controls because in MultiView that means when the views are switched (ActiveViewIndex) the controls in the new view are absolution position which means they are displayed lower down the page (where they were arranged in the original view...
1
2012
by: Roger | last post by:
While there are several web sites that make use of sidebars, there are relatively few that make use of fixed position sidebars. While fixed position sidebars offer the advantage of having the page controls and hyperlinks always visible when the user scrolls down a page, they have one great disadvantage: a portion of the fixed position sidebar may not be visible for some users because of a combination of small vertical height and the...
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10495
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7573
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.