473,396 Members | 2,111 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,396 software developers and data experts.

combining funtionality from two pages

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 1001
Hi,

Convert both of your aspx page to a ascx user control and drop both of
them in a aspx page

follow this thread to get a step by step guide for converting
aspx(page) to ascx(usercontrol)

http://www.dotnetspider.com/forum/Vi...px?ForumId=121

Thanks

Munna

www.munna.shatkotha.com
Jun 27 '08 #2

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

Similar topics

2
by: Brian | last post by:
Hi All, Can someone please point me in the right direction I am having problems combining JS and ASP. What I am trying to do is store in a database using ASP the referring page of my visitors. ...
2
by: Chris Mullins | last post by:
I've spent a bit of time over the last year trying to implement RFC 3454 (Preparation of Internationalized Strings, aka 'StringPrep'). This RFC is also a dependency for RFC 3491...
3
by: alwayswinter | last post by:
I currently have a form where a user can enter results from a genetic test. I also have a pool of summaries that would correspond to different results that a user would enter into the form. I...
7
by: Barry | last post by:
Hi all, I've noticed a strange error on my website. When I print a capital letter P with a dot above, using & #7766; it appears correctly, but when I use P& #0775 it doesn't. The following...
22
by: Martin C | last post by:
I have inherited a database which has a table for each of our 1200 customers. Each table is exactly the same. It is very difficult to generate reports I would like to create a new table and take...
5
by: Michael Herman \(Parallelspace\) | last post by:
1. What are some compelling solutions for using Master/Content pages with Web Pages? 2. If a content area has a web part zone with web parts, what is the user experience like when "editting" the...
1
by: Bond | last post by:
Hi friend I just wanna know how to Combine Fash pages or dreamviwer pages with ASP.Net or VB.Net Page and how to use the AD Rotator Component in ASP.Net thanking you
5
by: Tristan Miller | last post by:
Greetings. Is it possible using HTML and CSS to represent a combining diacritical mark in a different style from the letter it modifies? For example, say I want to render Å‘ (Latin small letter...
1
by: Andy B | last post by:
I have 2 web applications: Main and InHim. I currently have 2 domain names pointing to these applications. www.eternityrecords.org/ points to Main and www.inhim.eternityrecords.org points to InHim....
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.