ASP.Net C#.Net

Create simple guest book in ASP.Net and C#.Net


Sometimes we need to put guest book in our website. Suppose we don’t have any database to save the data. At that time, what can we do to save the data?

We can use simple text file to save the data.

check below code :

in page.ASPX page :

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
    <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cstyle%20%3E%0A%20%20%20%20hr%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20h" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;style&gt;" title="&lt;style&gt;" />
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick">
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode ="Conditional"  runat="server">
        <Triggers >
           <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        <ContentTemplate >
            <asp:Label ID="Label1" runat="server" Text=""></asp:Label><br />
            <div style ="width :815px; height :500px; overflow :auto ">
                <asp:Label ID="lblMsg" style="padding:5px" runat="server" Text="" Width ="800px" BorderColor ="Teal" BorderWidth ="1px" BorderStyle ="Solid" BackColor ="AliceBlue"  ></asp:Label>
        <asp:UpdatePanel ID="UpdatePanel2" UpdateMode ="Conditional" runat ="server" >
        <Triggers >
        <asp:PostBackTrigger ControlID ="btnSend" />
        <ContentTemplate >
        <br /><br />
            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate ="txtName" ErrorMessage="Enter Your Name"></asp:RequiredFieldValidator>
            <br />
            <asp:TextBox ID="txtMsg" TextMode ="MultiLine" Width="500px" Height="60px" runat="server" ></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate ="txtMsg" ErrorMessage="Enter Message"></asp:RequiredFieldValidator>
            <asp:Button ID="btnSend" runat="server" Text="Submit" Font-Bold ="true"  onclick="btnSend_Click" />

Now download for full source code and cs code file :

Download Full Working Source Code from below links :


Thank You.

How useful was this post?

Click on a star to rate it!

Leave a Reply

Your email address will not be published. Required fields are marked *