如何在单行中添加标签 [英] how to add the labels in single line

查看:114
本文介绍了如何在单行中添加标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标签lbl2 = e.Row.FindControl("lblName")作为标签;
标签lbl3 = e.Row.FindControl("lblKeyword")作为标签;
标签lbl4 = e.Row.FindControl("lblKey")作为标签;



Label lbl2 = e.Row.FindControl("lblName") as Label;
Label lbl3 = e.Row.FindControl("lblKeyword") as Label;
Label lbl4 = e.Row.FindControl("lblKey") as Label;



foreach (GridViewRow rows in gvRules.Rows)
             {


                 lbl1.Text + "If" + lbl3.Text + "then Action " + lbl2.Text +;


             }




我想在每种情况下都在其中添加标签..我希望这就像绑定网格时的句子一样..plz更多信息




i want to add the labels in in for each condition..i want this as like a sentence while bind grid ..plz sahre ur idea

推荐答案

string addAll="";
foreach (GridViewRow rows in gvRules.Rows)
{
  addAll += lbl2.Text + "If" + lbl3.Text + "then Action " + lbl2.Text ;
}
//addAll contains all the appended text which you can display.



您还可以使用字符串生成器 [ ^ ]



You can also use string Builder[^]


这篇关于如何在单行中添加标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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