|
-
May 17th, 2010, 10:09 AM
#5
Re: Disable specific button from set of programatically created buttons?
The point is that "Name" is not in the LinkLabel's property list, it's not a recognized command... Maybe Im missing an import? My current imports are:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
using System.Drawing;
using System.IO;
using System.Collections;
 Originally Posted by JonnyPoet
Tobe able to be recognized as "LinkButton" you need to set the name Property during creation of that buttons as I have already told you You need to add that line into your CreateSetOfLinkLabels Method
Code:
protected void CreateSetOfLinklabels() {
for (int i = 1; i < miPages + 1; i++){
// Add label with corresponding page no
mLbtnPage = new LinkButton();
mLbtnPage.ID = i.ToString();
mLbtnPage.Text = i.ToString();
mLbtnPage.Name ="LinkButton";
holderPages.Controls.Add(mLbtnPage);
mLbtnPage.Click += new EventHandler(lbtnPage_Click);
Literal literalSpace = new Literal();
literalSpace.Text = " ";
holderPages.Controls.Add(literalSpace);
}
}
If you dont add this, my other code will not work! If you do it will ! 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|