阅读更多asp.net中的Linkbutton [英] Read More Linkbutton in asp.net

查看:66
本文介绍了阅读更多asp.net中的Linkbutton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有管理面板,因为我有一个页面是adoutUs,页面设计为id,每次使用单个id的文本时我都必须更新文本,但是在前端,我有显示管理面板文本数据,但它显示所有数据交叉设计,所以我想放置链接按钮,即ReadMore,我该如何放置以及如何将下一个数据提供给ReadMore链接按钮(在这里,我面临的问题是后端文本数据​​显示不完整,所以我想让数据阅读更多按钮)请任何人知道帮助我

Hi,

I have admin panel in that i have one page that is adoutUs that page design is id,text i have to update every time text with single id,but in front-end i have display admin pannel text data, but its displaying all data crossing the design so i want to place link button i.e ReadMore how can i place and how can i give next data to ReadMore link-button(here i am facing problem back-end text data displaying full so i want give data to read more button) Please any body know help me

推荐答案

检查此脏代码.
Check this dirty code.
//get your data from db to a string.
string strTemp = "I have admin panel in that i have one page that is adoutUs that page design is id,text i have to update every time text with single id,but in front-end i have display admin pannel text data, but ";
//check fot number of characters you want to display before read more
if (strTemp.Length > 100)
           {
               if (strTemp.IndexOf(' ', 100) != -1)
               {
                  string  stripped = Regex.Replace(strTemp, @"<(.|\n)*?>", string.Empty);
   //you can redirect using id as query string                
 stripped = stripped.Substring(0, stripped.IndexOf(" ", 50)) + " <a href='default.aspx?redirect=yes'>Read More</a>";                 
                    Label1.Text = stripped;
               }
               else
               {
                  Label1.Text = strTemp;
               }
//check for the query string value.
if (Request.QueryString["redirect"] == "yes")
            {
                Label1.Text = strTemp;//Response.Write(strTemp);
            }


如果您使用中继器来绑定用户端的数据,则可以使用以下代码:

If you are using a repeater for binding the data from user end, you can use the following :

private void dataList_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
      if( (e.Item.ItemType == ListItemType.Item) || ( e.Item.ItemType == ListItemType.AlternatingItem))
      {
            HyperLink hyplnk = (HyperLink)e.Item.FindControl("lnkReadmore");
            if (hyplnk.Text.length > 20 )
            {
                 hyplnk.Text = hyplnk.Text.Substring(0,20);
            }
      }
}



如果我误解了您的问题,请随时纠正我.
希望以上信息对您有所帮助.如果您还有其他顾虑,请告诉我.



If i misunderstand your question, please feel free to correct me.
I hope the above information will be helpful. If you have more concerns, please let me know.


这篇关于阅读更多asp.net中的Linkbutton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆