1
我想創建一個Tab平板與鏈接按鈕,我的代碼是:如何更改可見面板?
// create title panel
for (int i = 0; i < 5; i++)
{
Ctrl.Controls.Add(new LiteralControl(string.Concat("<li role=\"presentation\" class=\"rightcolomn\">")));
LinkButton lb = new LinkButton();
lb.ID = i.ToString();
lb.Text =i.ToString();
lb.Click += new EventHandler(this.lbnTitle_Click);
Ctrl.Controls.Add(lb);
Ctrl.Controls.Add(new LiteralControl("</li>"));
}
// this code we create panels
for (int i = 0; i < 5; i++)
{
Panel pn = new Panel();
pn.ID = "p" + i.ToString();
for (int j = 0; j < 3; j++)
{
//some code add to panel
}
pn.Visible = false;
Ctrl.Controls.Add(pn);
}
// code for link button click is:
protected void lbnTitle_Click(object sender, EventArgs e)
{
LinkButton ClickedLink = (LinkButton)sender;
}
當我點擊鏈接按鈕,我想相應的面板被設置爲可見,這樣的事情:panel("p"+linkbutton.ID).Visible=true
如何訪問面板並做到這一點?
Ctrl
是asp:PlaceHolder
。