Eric3141
asked on
Can't hide GridView Delete button programmatically -- help!
We're using C#.
Need to hide Delete button on GridView programmatically when user has certain roles, etc.
Found this online and looks great but does not hide Delete button:
this.GridView1.AutoGenerat eDeleteBut ton = false;
I"ve tried putting it in the Page_Load event handler and the GridView1_RowDataBound event handler.
I'd like to use this command as it seems very straigtforward. Ideas?
Thx!
Need to hide Delete button on GridView programmatically when user has certain roles, etc.
Found this online and looks great but does not hide Delete button:
this.GridView1.AutoGenerat
I"ve tried putting it in the Page_Load event handler and the GridView1_RowDataBound event handler.
I'd like to use this command as it seems very straigtforward. Ideas?
Thx!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Uday: I tried that and it works. I prefer to do that sort of thing in the .cs page, though - just my preference.
Bura - I made the delete button a template field then did Find Control then set Visible = false;
Works great.
Bura - I made the delete button a template field then did Find Control then set Visible = false;
Works great.
ASKER
I looked at the article and now have this in my source view of aspx page:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="True"
DataKeyNames="intCaseActio
AutoGenerateDeleteButton="
<Columns>...
The article did not say to do this but I changed AutoGenerateColumns="False
Then in my page_load I have:
GridView1.AutoGenerateDele