请各位朋友们帮我看下我的代码为何图片不显示
前台:
<div>
<asp:TextBox ID="TextBox1" runat="server" Height="93px" TextMode="MultiLine"
Width="255px"></asp:TextBox>
<br />
<asp:ImageButton ID="ImageButton1" runat="server" onclick="ImageButton1_Click"
ImageUrl="~/biaoqing/Images/em1.gif" />
<asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/biaoqing/Images/em2.gif"
onclick="ImageButton2_Click" />
<asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/biaoqing/Images/em3.gif"
onclick="ImageButton3_Click" />
<asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/biaoqing/Images/em4.gif"
onclick="ImageButton4_Click"
/>
<asp:ImageButton ID="ImageButton5" runat="server" ImageUrl="~/biaoqing/Images/em5.gif"
onclick="ImageButton5_Click"
/>
<asp:ImageButton ID="ImageButton6" runat="server" ImageUrl="~/biaoqing/Images/em6.gif"
onclick="ImageButton6_Click" />
<asp:ImageButton ID="ImageButton7" runat="server" ImageUrl="~/biaoqing/Images/em7.gif"
onclick="ImageButton7_Click" />
<asp:ImageButton ID="ImageButton8" runat="server" ImageUrl="~/biaoqing/Images/em8.gif"
onclick="ImageButton8_Click" />
<asp:ImageButton ID="ImageButton9" runat="server" ImageUrl="~/biaoqing/Images/em9.gif"
onclick="ImageButton9_Click" />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
<br />
</div>
后台:
protected void Button1_Click(object sender, EventArgs e)
{
string strContent = TextBox1.Text;
//下面使用了正则表达式Regex类下的Replace方法。
string strResult1 = Regex.Replace(strContent, @"{!", "<img src='~/biaoqing/Images/'");
string strResult2 = Regex.Replace(strResult1, @"!}", ".gif/>");
Response.Write(strResult2.ToString());
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
TextBox1.Text += "{!01!}"; //01是图片的名称,
}
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
TextBox1.Text += "{!02!}"; //01是图片的名称,
}
.
.
.