CssClass="ProductListing"
Width="100%">
No Announcements Available
<%# Eval("Title") %>
<%# Eval("Announcements") %>
<%# string.Format("{0:dd-MMM-yyyy}", Eval("DateCreated"))%>
i Highlighted the templatefield which i wanted to change, i would like to set visible to false for btnEdit and btnDelete if userType = customer. I need to do it in the Codebehind can anyone help me? i know i just need to declare some stuff before doing the if else but i dont know how to :( any help is appreciated so thanks in advance :)

Blocked AccountRank #403 · 6.2K reputationPosted Jul 25, 2011, 3:10 AM EDT
Hi,
Write the code in RowDataBound event.
protected void gvAnnouncement _RowDataBound(object sender, GridViewRowEventArgs e){
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button ButtonEdit = (Button)e.Row.FindControl("btnEdit ");
Button ButtonDelete = (Button)e.Row.FindControl("btnDelete ");
//Check the User Type Here
If(UserType="Admin")
{
ButtonEdit.Visible = true;
ButtonDelete.Visible = true;
}
Else
{
ButtonEdit.Visible = false;
ButtonDelete.Visible = false;
}
}
}
Toh Zuan Yi16 reputationPosted Jul 25, 2011, 5:38 PM EDT
Blocked AccountRank #403 · 6.2K reputationPosted Jul 25, 2011, 7:34 PM EDT