当我从众多中选择一个时,我希望emojis显示在文本框中 [英] I want emojis to be displayed on textbox when I select one from many
本文介绍了当我从众多中选择一个时,我希望emojis显示在文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的聊天应用程序中使用表情符号,当我点击我的一个表情符号时,我将它显示在我的文本框中。这是从数据库插入的。
实际上我在项目命令事件上尝试了代码..比如下面
但问题是如何显示emojis特殊图像到文本框。
我尝试过:
i am using emojis for my chat application and i wnt it to be displayed on my textbox when i click on one of emojies i have. which are inserted from database.
actually i tried code on item command event.. like below
but the problem is how to display that emojis special images to the textbox.
What I have tried:
<div class="send-message">
<div class="input-group">
<asp:TextBox ID="txttosnd" class="form-control" runat="server" placeholder="Type your message"></asp:TextBox>
<asp:Panel ID="panemoji" class="form-control" runat="server">
<asp:ImageButton ID="img" runat="server" ImageUrl="~/images/emoji_icon.jpeg" OnClick="img_Click" />
</asp:Panel>
<asp:Panel style="left:100px" ID="panemoj" runat="server" Visible="false">
<asp:DataList ID="dlemojrep" runat="server" RepeatDirection="Horizontal" OnItemCommand="dlemojrep_ItemCommand" RepeatColumns="4" RepeatLayout="Table">
<ItemTemplate>
<asp:ImageButton runat="server" Style="margin: 0px 5px 5px 0px;" Width="30px" Height="30px" CommandArgument='<%#Eval("emojies_id") %>' CommandName="imgemoji" class="img-responsive" ID="imgbtn" alt="user" ImageUrl='<%# "~/ImagePage.aspx?emojiid=" + System.Convert.ToString(Eval("emojies_id")) %>' />
</ItemTemplate>
</asp:DataList>
</asp:Panel>
<span class="input-group-btn">
<asp:Button ID="btnsndmsg" runat="server" CssClass="btn btn-default" OnClick="btnsndmsg_Click" Text="Send" />
</span>
</div>
</div>
rotected void dlemojrep_ItemCommand(object source, DataListCommandEventArgs e)
{
int USER_ID = Convert.ToInt32(Session["USERID"]);
if (USER_ID != 0)
{
if (e.CommandName == "imgemoji")
{
touid = Convert.ToInt32(e.CommandArgument);
oluserid.Value = touid.ToString();
SqlConnection conn = new SqlConnection(c.connStr);
conn.Open();
SqlCommand cmd = new SqlCommand("select emo_pic from tbl_emoji where emojies_id= '" + touid + "'", conn);
int chatreqacc = Convert.ToInt32(cmd.ExecuteScalar());
if (chatreqacc != 0)
{
GetMessages();
tblchat.Visible = true;
}
else
{
ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Sorry! you can not send message, your caht request has been declined');", true);
tblchat.Visible = false;
}
}
}
}
推荐答案
根据我的评论,如果你想要显示你需要使用的文本和图像 RichTextBox [ ^ ]而不是TextBox
As per my comment, if you want to display both text and images you need to use a RichTextBox[^] instead of a TextBox
这篇关于当我从众多中选择一个时,我希望emojis显示在文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文