使用按钮,链接视图控件中的图像 [英] using button,image in link view control
本文介绍了使用按钮,链接视图控件中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以告诉我如何在微软Visual Studio 2010中的链接视图控件中使用按钮和图像。我无法编写必须在按钮点击时执行的c#代码。我在linkview控件中有标签,但我无法在页面加载功能中访问它们。我不知道为什么。上帝保佑你。请帮助我。
Can anyone tell me how to use button and images in link view control in microsoft visual studio 2010. i am unable to write c# code that has to be executed on button click. i have labels in the linkview control but i am unable to access them in page load function. i dont know why. god bless you.please help me.
推荐答案
使用FindControl访问列表视图中的标签
protected void ListView_ItemDataBound(object sender,ListViewItemEventArgs e)
{
if(e.Item.ItemType == ListViewItemType.DataItem)
{
var lbl = e.Item.FindControl(Label1)作为标签;
}
}
如果您不想使用findcontrol方法,请查看以下链接
http://blogs.msdn.com/b/scothu/archive/2008/03/26/accessing- controls-in-listview-templates.aspx [ ^ ]
希望这有帮助
Use FindControl to access the labels inside the listview
protected void ListView_ItemDataBound(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
var lbl = e.Item.FindControl("Label1") as Label;
}
}
If you dont want to use the findcontrol method check the below link
http://blogs.msdn.com/b/scothu/archive/2008/03/26/accessing-controls-in-listview-templates.aspx[^]
Hope this helps
你驾驶室使用内置控制ima ge按钮。
you cab use inbuilt control image button.
这篇关于使用按钮,链接视图控件中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文