473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

positioning of html and aspx elements

Thanks for any help folks:

I have two .aspx pages that are workling well: one is for entering
entries in a blog and another for viewing those entries. What I want
to do is combine the two into one so I have a textbox and submit
button at the top and the blog entries below. Any ideas?
Here is my entry page:
<%@ import Namespace="System.Data" %>
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Using ds As New DataSet()
ds.ReadXml(Server.MapPath("blog.xml"))
txtNewEvent.DataBind()
txtDate.DataBind()
End Using
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSubmit.Click
Using ds As New DataSet()
ds.ReadXml(Server.MapPath("blog.xml"))
Dim dr As DataRow = ds.Tables(0).NewRow()
dr("entry") = txtNewEvent.Text
dr("name") = txtDate.Text
ds.Tables(0).Rows.Add(dr)
ds.WriteXml(Server.MapPath("blog.xml"))
Response.Redirect("http://site.com/Default.aspx")
End Using
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("http://site.com/Default.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Blog Entry</title>
<style type="text/css">
#Form1
{
height: 508px;
width: 727px;
}
</style>
</head>
<body background="vignette.gif" runat="server">
<a href="javascript:my_win()"></a<form id="Form1" method="post"
runat="server">

<b>
<a href="/demos/books.xml"></a>
<asp:Label ID="Label2" runat="server" BackColor="#00C0C0" Font-
Bold="True" Font-Size="Large"
Text="Enter your comments into our blog:" Width="375px"
BorderStyle="Outset"></asp:Label>
<asp:TextBox ID="txtNewEvent" runat="server" Width="451px"
Height="212px"
style="padding-right: 5%; padding-left: 5%; padding-bottom:
5%; margin: 5%; padding-top: 5%"
TextMode="MultiLine"></asp:TextBox>

<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click" /></b><br />
<asp:Label ID="Label1" runat="server" BackColor="#00C0C0"
Font-Bold="True" Text="Your Name" BorderStyle="Outset"></asp:Label>
<asp:TextBox ID="txtDate" runat="server" Width="266px"></
asp:TextBox>
<p>
<b>
<asp:Button ID="Button1" runat="server" BackColor="Aqua"
Style="z-index: 107; left: 750px;
position: absolute; top: 488px; font-weight: 700; width:
168px;"
Text="Home" onclick="Button1_Click" />
</b></p>
<p>
</p>
</form>
</body>
</html>
Here is my viewing page:
<%@ import Namespace="System.Data" %>
<script runat="server">
Private Function MakeDataView() as DataView
Dim myDataSet As New DataSet()
myDataSet.ReadXml(Server.MapPath("blog.xml"))
Dim view As DataView = New DataView(myDataSet.Tables(0))
view.AllowDelete = False
view.AllowEdit = False
view.AllowNew = False
view.Sort = "name ASC"
Return view
End Function
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim view as DataView = MakeDataView()
dgBooksPretty.DataSource = view
dgBooksPretty.AllowSorting = True
dgBooksPretty.DataBind()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Our Blog</title>
</head>
<body borderwidth="20px" background="vignette.gif">
<div align="left"
style="border-style: inset; border-color: white;
overflow: auto; font-size: medium; width: 84%;
font-family: 'Times New Roman'; height: 599px;
color: black; left: 79px; position: absolute;
top: 11%; background-color: #ccffff; padding-right:
10px; float: none; margin-left: 20px;
clip: rect(auto auto auto auto); text-indent: 5%;
text-align: left; padding-left: 10px;">
<div style="text-indent: 20px">
<asp:datagrid id="dgBooks"
runat="server"
Visible="False"
Height="1px"
Width="1px" />
<asp:datagrid id="dgBooksPretty"
runat="server"
AutoGenerateColumns="False"
Font-Name="Verdana"
Font-Size="Small"
HorizontalAlign="Center"
ItemStyle-BackColor="#C0FFC0"
AlternatingItemStyle-BackColor="White"
Width="911px"
Height="128px"
AllowSorting="True"
BorderColor="PeachPuff"
BorderStyle="Outset"
BorderWidth="10px" CellSpacing="2">
<HeaderStyle BackColor="DarkGreen"
HorizontalAlign="Center"
ForeColor="White"
Font-Bold="True" />
<Columns>
<asp:BoundColumn HeaderText="Blog Entry" DataField="entry" />
<asp:BoundColumn HeaderText="Name" DataField="name" />
</Columns>
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#C0FFC0" />
</asp:datagrid>
<p align="center">
</p>
</body>
</html>
Jun 27 '08 #1
1 1072
On May 30, 8:13 am, slinky <campbellbrian2...@yahoo.comwrote:
Thanks for any help folks:

I have two .aspx pages that are workling well: one is for entering
entries in a blog and another for viewing those entries. What I want
to do is combine the two into one so I have a textbox and submit
button at the top and the blog entries below. Any ideas?

Here is my entry page:

<%@ import Namespace="System.Data" %>
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Using ds As New DataSet()
ds.ReadXml(Server.MapPath("blog.xml"))
txtNewEvent.DataBind()
txtDate.DataBind()
End Using
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSubmit.Click
Using ds As New DataSet()
ds.ReadXml(Server.MapPath("blog.xml"))
Dim dr As DataRow = ds.Tables(0).NewRow()
dr("entry") = txtNewEvent.Text
dr("name") = txtDate.Text
ds.Tables(0).Rows.Add(dr)
ds.WriteXml(Server.MapPath("blog.xml"))
Response.Redirect("http://site.com/Default.aspx")
End Using
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("http://site.com/Default.aspx")
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Blog Entry</title>
<style type="text/css">
#Form1
{
height: 508px;
width: 727px;
}
</style>
</head>

<body background="vignette.gif" runat="server">
<a href="javascript:my_win()"></a<form id="Form1" method="post"
runat="server">

<b>
<a href="/demos/books.xml"></a>
<asp:Label ID="Label2" runat="server" BackColor="#00C0C0" Font-
Bold="True" Font-Size="Large"
Text="Enter your comments into our blog:" Width="375px"
BorderStyle="Outset"></asp:Label>
<asp:TextBox ID="txtNewEvent" runat="server" Width="451px"
Height="212px"
style="padding-right: 5%; padding-left: 5%; padding-bottom:
5%; margin: 5%; padding-top: 5%"
TextMode="MultiLine"></asp:TextBox>

<asp:Button ID="btnSubmit" runat="server" Text="Submit"
OnClick="btnSubmit_Click" /></b><br />
<asp:Label ID="Label1" runat="server" BackColor="#00C0C0"
Font-Bold="True" Text="Your Name" BorderStyle="Outset"></asp:Label>
<asp:TextBox ID="txtDate" runat="server" Width="266px"></
asp:TextBox>

<p>
<b>
<asp:Button ID="Button1" runat="server" BackColor="Aqua"
Style="z-index: 107; left: 750px;
position: absolute; top: 488px; font-weight: 700; width:
168px;"
Text="Home" onclick="Button1_Click" />
</b></p>
<p>

</p>
</form>
</body>
</html>

Here is my viewing page:

<%@ import Namespace="System.Data" %>
<script runat="server">
Private Function MakeDataView() as DataView
Dim myDataSet As New DataSet()
myDataSet.ReadXml(Server.MapPath("blog.xml"))
Dim view As DataView = New DataView(myDataSet.Tables(0))
view.AllowDelete = False
view.AllowEdit = False
view.AllowNew = False
view.Sort = "name ASC"
Return view
End Function

Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim view as DataView = MakeDataView()
dgBooksPretty.DataSource = view
dgBooksPretty.AllowSorting = True
dgBooksPretty.DataBind()
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >

<head id="Head1" runat="server">
<title>Our Blog</title>
</head>
<body borderwidth="20px" background="vignette.gif">
<div align="left"
style="border-style: inset; border-color: white;
overflow: auto; font-size: medium; width: 84%;
font-family: 'Times New Roman'; height: 599px;
color: black; left: 79px; position: absolute;
top: 11%; background-color: #ccffff; padding-right:
10px; float: none; margin-left: 20px;
clip: rect(auto auto auto auto); text-indent: 5%;
text-align: left; padding-left: 10px;">
<div style="text-indent: 20px">
<asp:datagrid id="dgBooks"
runat="server"
Visible="False"
Height="1px"
Width="1px" />
<asp:datagrid id="dgBooksPretty"
runat="server"
AutoGenerateColumns="False"
Font-Name="Verdana"
Font-Size="Small"

HorizontalAlign="Center"
ItemStyle-BackColor="#C0FFC0"
AlternatingItemStyle-BackColor="White"
Width="911px"
Height="128px"
AllowSorting="True"
BorderColor="PeachPuff"
BorderStyle="Outset"
BorderWidth="10px" CellSpacing="2">
<HeaderStyle BackColor="DarkGreen"
HorizontalAlign="Center"
ForeColor="White"
Font-Bold="True" />
<Columns>
<asp:BoundColumn HeaderText="Blog Entry" DataField="entry" />
<asp:BoundColumn HeaderText="Name" DataField="name" />
</Columns>
<AlternatingItemStyle BackColor="White" />
<ItemStyle BackColor="#C0FFC0" />
</asp:datagrid>
<p align="center">
</p>
</body>
</html>
I didn't read your code, but I have a suggestion none the less.

What you might try is to convert your Pages into ASP.NET UserControls
and add them to a single page, one positioned on top of the other one.

Thanks,

Seth Rowe [MVP]
Jun 27 '08 #2

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

Similar topics

36
by: Jack Hughes | last post by:
This argument has come up two or three times lately. We have a web standards document at our company that say "Use valid HTML 4; We don't recommend switching to DIV-based CSS-P for layout just...
4
by: Jane Withnolastname | last post by:
I am trying to re-work an old site by replacing the html with css. On the main page, I have a logo image which I needed centred on the initial screen. I found the solution here:...
2
by: Tim Charles | last post by:
Hello I am close to finishing my first properly css-friendly site (at least I hope it is), and am looking for some general feedback, plus a specific question answered, if possible. ...
11
by: NS | last post by:
I am relativly new to css positioning and have a question regarding the display of a DHTML pop-up Here is the basic HTML I am using: <html> <head> <script language="JavaScript"> <!--
17
by: pasdecrap | last post by:
The following code will produce similar results in IE6 and firefox 1.0.4 however the left margin in FF is 4 pixels and in IE it is 5. Can anyone see why this is happening? I can't seem to figure...
1
by: John Leeke | last post by:
How are images positioned on a page? In particular, how do I adapt the following javascript code: ********** <img src="officecam0000.jpg" name="myImageName"> <script language="JavaScript">...
7
by: GaryDean | last post by:
In my old 1.1 apps the default was MS_POSITIONING="GridLayout" and Textboxes and labels and such always had POSITION: absolute; and I never had any distortion when the page was rendered. Life was...
5
by: aljamala | last post by:
Hi, I have a group of 5 tables laid out of the web page. 2 go on the left side and 3 on the right. These tables retrieve data from the database so the number of records (rows) returned varies....
5
by: Howard | last post by:
I have seen a lot of examples of 2 & 3 Collumn layout schemes. But I have not yet found any examples for positioning images and centering them by the browser. I notice that there are CSS...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...

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.