Click here to Skip to main content
15,888,590 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello Friends...

Please guide me how can I hide or visible asp:ButtonField in gridview programatically.

I am using asp:boundfield in gridview in the last and second last column.
I have another two more button which show data differently.. in the gridview..
Button Search and Button Archive...

if i see the record in search i can move the data in archrive. and button text archive is visible and button text restore should not be visible.

and if i look for result archive then button text restore should visible but button text cancel should be false..

I tried to hide their coulumn but once i hide any one of them it remain hidden..
due to its cloumn index.


XML
<asp:ButtonField CommandName="archive" HeaderText="Archive" ShowHeader="True" Text="Archive" ButtonType="Image" ImageUrl="~/Images/Cancel.png" />
                                
<asp:ButtonField CommandName="restore" Visible="false" HeaderText="Restore" ShowHeader="true" Text="Restore" ButtonType="image" ImageUrl="~/Images/Restore.jpg" />



Regards
Manish Kumar Namdev
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900