700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 如何在c#代码中从itemtemplate的文本框中获取值?

如何在c#代码中从itemtemplate的文本框中获取值?

时间:2019-07-06 14:33:23

相关推荐

如何在c#代码中从itemtemplate的文本框中获取值?

如下为c#代码

protected void Button2_Click(object sender, EventArgs e){System.Web.UI.WebControls.Button btn = sender as System.Web.UI.WebControls.Button;if (btn != null){//string title = mandArgument.ToString();ClsCmntModel clsCmnt = new ClsCmntModel();DataListItem item = btn.NamingContainer as DataListItem;if (item != null){//find the Label and get the text:Label lb3 = item.FindControl("Label3") as Label;Label lb2 = item.FindControl("Label2") as Label;System.Web.UI.HtmlControls.HtmlInputText txt2 = (System.Web.UI.HtmlControls.HtmlInputText)item.FindControl("Text1");string id = lb3.Text;string value = txt2.Value;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。