Find Control Under RowCommand
protected void GridViewtemp_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "AddSchedule")
{
pnlschedule.Visible = true;
lblscheduleforItem.Text = e.CommandArgument.ToString();
GridViewRow row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
Label lblDate = (Label)row.Cells[0].FindControl("lblName");
string teamName = lblDate.Text;
int rowindex = row.RowIndex;
lblscheduleforItemName.Text = ((Label)GridViewtemp.Rows[rowindex].FindControl("lblName")).Text;
}
}
protected void GridViewtemp_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "AddSchedule")
{
pnlschedule.Visible = true;
lblscheduleforItem.Text = e.CommandArgument.ToString();
GridViewRow row = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
Label lblDate = (Label)row.Cells[0].FindControl("lblName");
string teamName = lblDate.Text;
int rowindex = row.RowIndex;
lblscheduleforItemName.Text = ((Label)GridViewtemp.Rows[rowindex].FindControl("lblName")).Text;
}
}
No comments:
Post a Comment