TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
monica singh
NA
15
7.5k
Add click event to dynamically creatd linkbutton in gridview
Jun 21 2016 5:50 AM
Hello
I am working on application which requires to generate dynamic columns in gridview and then bound with linkbutton.
this much is done , but i have to add click event to link button but event is not fired .
below is code which i have tried.
below code is inside rowbound event of gridview.
foreach (DateTime dt in days)
{
LinkButton lb = new LinkButton();
lb.ID = "lb" + i;
lb.Attributes.Add("runat", "server");
lb.Text = r1[dt.Date.ToString("dd-MM-yyyy")].ToString();
lb.CommandName = "UpDate";
lb.Command += lb_Command;
// lb.OnClientClick += new EventHandler(onLinkClick);
// lb.Click += new System.EventHandler(onLinkClick);
// lb.DataBinding += lb_DataBinding;
row.Cells[i + 2].Controls.Add(lb);
i++;
if (dt.Date <= System.DateTime.Today)
{
lb.Enabled = false;
}
}
Reply
Answers (
1
)
Which web editor do you prefer?
Radio Button Group