Wednesday, August 10, 2011

Item databound in RadGrid

protected void RGUserDisplay_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
try
{
if (e.Item is GridDataItem)
{

GridDataItem gridDataItem = (GridDataItem)e.Item;

GridDataItem item = (GridDataItem)e.Item;
// Get the Linkbutton for Edit Button
LinkButton lnkEditButton = item.FindControl("rglnk_Edit") as LinkButton;

if(lnkEditButton != null)
{
lnkEditButton.Attributes.Add("onClick", "OpenQuestionModelPopup('" + this.popup_page.ClientID + "')");
}

//AdminModule objAdminModule = new AdminModule();
//string auid = "15";
//objAdminModule.DeleteRole(auid);

//LblSno.Text = intSerialNo.ToString();

/* if (strStatusText.ToLower() == "inactive")
{
imgControl.ImageUrl = Server.MapPath("Images/Red.gif");
imgControl.ToolTip = "Inactive";
}
else if (strStatusText.ToLower() == "active")
{
imgControl.ImageUrl = Server.MapPath("Images/Green.jpg");
imgControl.ToolTip = "active";

}*/
//intSerialNo++;
//ViewState["SNo"] = intSerialNo;
}

if (e.Item is GridHeaderItem)
{
GridHeaderItem gridHeaderItem = (GridHeaderItem)e.Item;

if (gridHeaderItem != null)
{
//==========Find the checkbox control in header and add an attribute=============
CheckBox chkAll = (CheckBox)gridHeaderItem.FindControl("chkCheckAll");
chkAll.Attributes.Add("onclick", "javascript:checkAll(this)");
}

}
}
catch (Exception ex)
{

using (objErrorLogs = new ErrorLogs())
{
objErrorLogs.Save_ErrorLog(this.AppRelativeVirtualPath.Replace(this.AppRelativeTemplateSourceDirectory, ""), MethodInfo.GetCurrentMethod().Name, ex.Message);
}
}

}

No comments:

Post a Comment