
成都創(chuàng)新互聯(lián)專注于企業(yè)營銷型網(wǎng)站、網(wǎng)站重做改版、京口網(wǎng)站定制設(shè)計、自適應(yīng)品牌網(wǎng)站建設(shè)、成都h5網(wǎng)站建設(shè)、電子商務(wù)商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、外貿(mào)營銷網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計等建站業(yè)務(wù),價格優(yōu)惠性價比高,為京口等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
源代碼:
<asp:DataList ID="DataList1" runat="server" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black"
Height="16px" Width="848px">
<AlternatingItemStyle BackColor="PaleGoldenrod" />
<FooterStyle BackColor="Tan" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<SelectedItemStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<ItemTemplate>
<img src="p_w_picpath/1.jpg" height="40" width="40">
留言者: <%# Eval("username") %>
EMAIL: <%# Eval("email") %>
留言時間: <%# Eval("posttime")%> <asp:LinkButton
ID="LinkButton1" runat="server">回復(fù)留言</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server">刪除留言</asp:LinkButton>
<br/><hr/>
留言內(nèi)容: <%# Eval("contente")%> <br/><hr/>
回復(fù)內(nèi)容: <%# Eval("reply")%> <br/><hr/>
</ItemTemplate>
</asp:DataList>
查看留言界面:
protected void Page_Load(object sender, EventArgs e)
{
string conn = "Data Source=.;Initial Catalog=Information;Integrated Security=True";
SqlConnection con = new SqlConnection(conn);
string sqlstr = "select*from Message";
SqlDataAdapter ad = new SqlDataAdapter(sqlstr,con);
DataSet ds = new DataSet();
con.Open();
ad.Fill(ds);
con.Close();
DataList1.DataSource = ds.Tables[0].DefaultView;
DataList1.DataBind();
}

留言界面:
using System.Data.SqlClient;
using System.Data;
protected void Button2_Click(object sender, EventArgs e)//取消留言
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
protected void Button1_Click(object sender, EventArgs e)//發(fā)送留言
{
string conn = "Data Source=.;Initial Catalog=Information;Integrated Security=True";
SqlConnection con = new SqlConnection(conn);
string sqlstr = "insert into Message(username,sex,email,contente,p_w_picpathadd)values('" + TextBox1.Text + "','" + RadioButtonList1.SelectedValue + "','" + TextBox2.Text + "','" + TextBox3.Text + "','3.jpg')";
SqlDataAdapter ad = new SqlDataAdapter(sqlstr, con);
DataSet ds = new DataSet();
ad.Fill(ds);
}
當(dāng)前標(biāo)題:asp.net簡易留言板
標(biāo)題鏈接:http://chinadenli.net/article30/goiiso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、網(wǎng)站建設(shè)、面包屑導(dǎo)航、網(wǎng)頁設(shè)計公司、網(wǎng)站排名、品牌網(wǎng)站設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)