标题:关于留言本的实现,请各位高手帮我填写关键代码
只看楼主
afliult
Rank: 1
等 级:新手上路
帖 子:72
专家分:0
注 册:2007-7-22
 问题点数:0 回复次数:3 
关于留言本的实现,请各位高手帮我填写关键代码
我在网上下载了一个留言本的代码,由于是VB 语言,我想改为
c#
 index.aspx 文件如下:
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<script runat="server">

</script>

<html xmlns="http://www. >
<head runat="server">
    <title>留言本首页</title>
<style type="text/css">
<!--
.style3 {color: #666666}
.style12 {font-size: 14px}
.style13 {color: #666666; font-size: 14px; }
-->
</style>   
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/bad.mdb"
            SelectCommand="SELECT * FROM [MessageBook]"></asp:AccessDataSource>
   
    </div>
   
  <table width="707" border="0">
    <tr>
      <td width="198" height="27">&nbsp;</td>
      <td colspan="2"><span class="style3"><img src="gif/logo.gif" width="259" height="36"></span></td>
    </tr>
    <tr>
      <td><span class="style13"><a href="post.aspx"><img src="gif/FIL3319.GIF" width="99" height="25" border="0" lowsrc="gif/FIL3319.GIF"></a></span></td>
      <td colspan="2"><span class="style13"></span></td>
    </tr>
    <tr>
      <td height="12" colspan="3"><div align="center"><img src="gif/gray.gif" width="662" height="10"></div></td>
    </tr>   
   
        <asp:DataList ID="DataList1" runat="server" DataKeyField="id" DataSourceID="AccessDataSource1">
   
      <ItemTemplate>
        <tr>
          <td width="198"><div align="center" class="style13 style12">
              <div align="center"><img src="gif/FIL119.JPG"></div>
          </div></td>
          <td colspan="2"><span class="style13"><strong>留言标题</strong>:<%# Eval("title") %></span></td>
        </tr>
        <tr>
          <td><div align="center" class="style13 style12"></div></td>
          <td colspan="2"><span class="style13"><a href="<%# Eval("PageUrl") %>"><img src="gif/FIL24113.GIF" width="47" height="18" border="0"></a> <a href="mailto:<%# Eval("email") %>"><img src="gif/FIL24111.GIF" width="45" height="18" border="0"></a> <img src="gif/FIL3241.GIF" alt="<%# Eval("Qicq") %>" width="45" height="18"> </span></td>
        </tr>
        <tr>
          <td rowspan="2"><div align="center" class="style13">
              <p align="center"><span class="style13 style12"><img src='<%# Eval("face") %>'></span></p>
              <p align="center">昵称:<%# Eval("MessageName") %></p>
          </div></td>
          <td colspan="2"><span class="style13"><img src='<%# Eval("Miange") %>'><%# Eval("MessageBook") %> </span></td>
        </tr>
        <tr>
          <td width="387" height="37"><span class="style13"><img src="gif/FIL23680.GIF" width="15" height="12">留言时间:<%# Eval("TimeInsert") %></span></td>
          <td width="108"><span class="style13">    </td>
        </tr>
        <tr>
          <td height="12" colspan="3"><div align="center"><span class="style12"><img src="gif/gray.gif" width="662" height="10"> </span></div></td>
        </tr>
      </ItemTemplate>                        
 
        </asp:DataList>
        
     </table>
         
    </form>
</body>
</html>






post.aspx 文件如下

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.

<script runat="server">
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        Image1.ImageUrl ="face/"+ DropDownList1.SelectedValue.ToString();   
    }

    protected void button1_Click(object sender, EventArgs e)
    {

    }
</script>

<html xmlns="http://www. >
<head runat="server">
    <title>无标题页</title>
</head>
<body>
    <form id="form1" runat="server">
  <table width="730" border="0">
    <tr>
      <td width="103">&nbsp;</td>
      <td width="597"><img src="gif/logo.gif" width="253" height="34"></td>
      <td width="16">&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">留言标题:</span></td>
      <td><span class="style3">
        <input name="title" type="text" id="title" runat="server" >
        *必填
        <asp:requiredfieldvalidator ID="Requiredfieldvalidator1" ControlToValidate="title" Display="Static" EnableClientScript="true" ErrorMessage="对不起!请输入留言标题!" runat="server" />        
      </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">昵&nbsp;&nbsp;&nbsp; 称:</span></td>
      <td><span class="style3">
        <input name="MessageName" type="text" id="MessageName" runat="server" >
        *必填
        <asp:requiredfieldvalidator ID="Requiredfieldvalidator2" ControlToValidate="MessageName" Display="Static" EnableClientScript="true" ErrorMessage="对不起!请输入你的昵称!" runat="server" />         
      </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">个人主页:</span></td>
      <td><span class="style3">
        <input name="PageUrl" type="text" id="PageUrl" runat="server" >
        <asp:regularexpressionvalidator ID="Regularexpressionvalidator1" ControlToValidate="PageUrl" Display="Static" ErrorMessage="对不起!你输入的主页网址格不对!(要http://)" runat="server"  ValidationExpression="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?" />        
      </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">电子邮箱:</span></td>
      <td><span class="style3">
        <input name="Email" type="text" id="Email" runat="server" >
        <asp:regularexpressionvalidator ID="Regularexpressionvalidator2" ControlToValidate="Email" Display="Static" EnableClientScript="true" ErrorMessage="对不起!你输入的电子邮箱地址格式不对!" runat="server" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" />        
      </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">QQ号码:</span></td>
      <td><span class="style3">
        <input name="Qicq" type="text" id="Qicq" runat="server" >
        <asp:rangevalidator ControlToValidate="Qicq" Display="Static" ErrorMessage="请输入正确的QQ号码!" ID="rang" MaximumValue="999999999999999" MinimumValue="10000" runat="server" />        
      </span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">选择头像:</span></td>
      <td rowspan=2><span class="style3">  
           <asp:Image ID="Image1" runat="server" Height="195px" Width="224px" ImageUrl="~/face/face1.GIF" /><br />

          </span></td>
      <td>&nbsp;</td>
    </tr>
      <tr>
          <td>   
          <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"
            Width="100px">
            <asp:ListItem Selected="True">face1.gif</asp:ListItem>
            <asp:ListItem>face2.gif</asp:ListItem>
            <asp:ListItem>face3.gif</asp:ListItem>
            <asp:ListItem>face4.gif</asp:ListItem>
            <asp:ListItem>face5.gif</asp:ListItem>
        </asp:DropDownList>        
                    <br />
                    <br />
                    <br />
              <br />
                    <br />
                </td>
          <td> &nbsp; </td>
      </tr>   
    <tr>
      <td><span class="style3">选择表情:</span></td>
      <td><p class="style1 style4">
          <input type=radio name=Miange value=Miange/FIL1.GIF checked >
          <img src="Miange/FIL1.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL7.GIF>
          <img src="Miange/FIL7.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL8.GIF>
          <img src="Miange/FIL8.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL11.GIF>
          <img src="Miange/FIL11.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL12.GIF>
          <img src="Miange/FIL12.GIF" border="0" >        </p>
        <p class="style3">         
          <input type=radio name=Miange value=Miange/FIL5.GIF>
          <img src="Miange/FIL5.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL39.GIF>
          <img src="Miange/FIL39.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL42.GIF>
          <img src="Miange/FIL42.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL50.GIF>
          <img src="Miange/FIL50.GIF" border="0" >
          <input type=radio name=Miange value=Miange/FIL47.GIF>
          <img src="Miange/FIL47.GIF" border="0" ></p></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style3">留言内容:</span></td>
      <td><span class="style3">
        <textarea name="MessageBook" cols="65" rows="10" id="MessageBook" runat="server" ></textarea>
        *必填
        <asp:requiredfieldvalidator ID="Requiredfieldvalidator3" ControlToValidate="MessageBook" Display="Static" EnableClientScript="true" ErrorMessage="对不起!请输入留言内容!" runat="server" />        
</span></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>
        <div align="left"></div>        
        <div align="center">
          <asp:button ID="button1" runat="server" Text="发表" OnClick="button1_Click" />         
&nbsp;&nbsp;&nbsp;
<input id="Reset1" type="reset" name="Submit2" value="重写" runat="server" >

<a href="index.aspx">查看留言 </a></div>      </td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><div align="center"><span class="style3"> 程序设计:B.A.D </span></div></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
        
    </form>
</body>
</html>

其中 post.aspx 文件中的提交函数应怎样实现,请各位帮我解决

    protected void button1_Click(object sender, EventArgs e)
    {

    }
搜索更多相关主题的帖子: 留言本 关键 代码 
2008-06-01 20:15
afliult
Rank: 1
等 级:新手上路
帖 子:72
专家分:0
注 册:2007-7-22
得分:0 
源码下载地址
http://www.
2008-06-01 20:18
hebingbing
Rank: 6Rank: 6
来 自:黄土高坡
等 级:贵宾
威 望:27
帖 子:3417
专家分:371
注 册:2007-10-22
得分:0 
连接数据库,更新数据库……
…………
2008-06-01 22:33
afliult
Rank: 1
等 级:新手上路
帖 子:72
专家分:0
注 册:2007-7-22
得分:0 
还是不懂,请帮我写一下,好吗?
2008-06-02 09:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-217061-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.326886 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved