日期:2014-05-17 浏览次数:20616 次
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton1</asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server">LinkButton2</asp:LinkButton>
<asp:LinkButton ID="LinkButton3" runat="server">LinkButton3</asp:LinkButton>
protected void Page_Load(object sender, EventArgs e)
{
foreach (KeyValuePair<string, LinkButton> item in GetPageControl())
{
if (item.Key.Contains("LinkButton2"))
{
item.Value.Visible = false;
}
}
}
private Dictionary<string, LinkButton> GetPageControl()
{
string CacheKey = "aaaaa";
object objDic = Common.DataCache.GetCache(CacheKey);
if (objDic == null)
{
try
{
Dictionary<string, LinkButton> dic = new Dictionary<string, LinkButton>();
foreach (Control childc in Page.Form.Controls)
{
if (childc is LinkButton)
{
dic.Add(childc.ID, childc as LinkButton);
}