获取数据列表中标签的值 [英] get the value of label in datalist

查看:199
本文介绍了获取数据列表中标签的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面名称产品类别"中有一个数据列表,在页面名称产品"中有数据列表
并且我想在产品类别"页面的数据列表中获取标签的值,以将其保存在会话中以在页面产品
中获取该类别的产品 谢谢...

添加了OP的附加信息
我尝试过这种方法,但是不起作用

I have a datalist in page name "Product Category" and datalist in page name "Product"
and i want to get the value of the label in datalist in page "product Category" to save it in the session to get the product of the category in page product
Thank you...

OP''s additional information added
i tried this method but it doesn''t work

protected void DataList1_SelectedIndexChanged(object sender, EventArgs e)
{
  Label lblLabel1 = (Label)DataList1.Items[DataList1.SelectedIndex].FindControl("Label1");
  Session["nam"] = lblLabel1.Text;
}

推荐答案

请查看:
http://asp.net-tutorials.com/state/sessions/ [了解ASP.NET中的会话管理技术 [ http://msdn.microsoft.com/en-us/library/ms178581 (v = vs.100).aspx [
Please have a look to:
http://asp.net-tutorials.com/state/sessions/[^]
Understanding Session Management Techniques in ASP.NET[^]
http://msdn.microsoft.com/en-us/library/ms178581(v=vs.100).aspx[^]


这篇关于获取数据列表中标签的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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