Showing posts with label Change gridview. Show all posts
Showing posts with label Change gridview. Show all posts
Friday, August 12, 2011
Friday, July 29, 2011
Set visible property of a control inside girdview using Eval
your control id.visible='<%# Convert.ToString(Eval("Status"))=="" ? Boolean.Parse("True"):Boolean.Parse("False") %>'>
Wednesday, July 27, 2011
Export only selected values
http://www.aspsnippets.com/Articles/ASP.Net-GridView-Export-only-selected-columns-to-Excel-Sheet.aspx
Tuesday, July 26, 2011
Fixed header gridview
http://www.aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-using-jQuery-Plugin.aspx
Saturday, July 2, 2011
Change gridview row style dynamically ...
Inside row databound ,
e.Row.Font.Bold = true;
e.Row.Style.Add("color","White");
e.Row.Style.Add("background-color", hf.Value);
e.Row.BackColor = Color.White; ( add namespace system.drawing)
Example :
protected void Gv_NOTICE_LIST_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField HF_Status = (HiddenField)e.Row.FindControl("Hf_NOTICE_STATUS");
ImageButton Delete = (ImageButton)e.Row.FindControl("ImgB_DELETE");
if (HF_Status.Value != "")
{
if (HF_Status.Value == "0")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Unread";
Delete.Enabled = false;
e.Row.Font.Bold = true;
Delete.Attributes.Add ("title", "An unreaded notice cant be delete");
}
else if (HF_Status.Value == "1")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Read";
Delete.Enabled = true;
}
//else if (HF_Status.Value == "2")
//{
// Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
// Lbl_Status.Text = "Deleted";
//}
}
}
}
e.Row.Font.Bold = true;
e.Row.Style.Add("color","White");
e.Row.Style.Add("background-color", hf.Value);
e.Row.BackColor = Color.White; ( add namespace system.drawing)
Example :
protected void Gv_NOTICE_LIST_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField HF_Status = (HiddenField)e.Row.FindControl("Hf_NOTICE_STATUS");
ImageButton Delete = (ImageButton)e.Row.FindControl("ImgB_DELETE");
if (HF_Status.Value != "")
{
if (HF_Status.Value == "0")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Unread";
Delete.Enabled = false;
e.Row.Font.Bold = true;
Delete.Attributes.Add ("title", "An unreaded notice cant be delete");
}
else if (HF_Status.Value == "1")
{
Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
Lbl_Status.Text = "Read";
Delete.Enabled = true;
}
//else if (HF_Status.Value == "2")
//{
// Label Lbl_Status = (Label)e.Row.FindControl("Lbl_Notice");
// Lbl_Status.Text = "Deleted";
//}
}
}
}
Subscribe to:
Posts (Atom)
