I am using a RadGrid, on load some of the columns are hidden. I have a button which should unhide those columns when clicked and the text should change to Hide. On click of the same button again the columns should hide. I am able to hide the columns successfully but unable to figure out how to unhide.
Here is the code:
<input type="button" id ="toggle" value = "Hide" onclick="HideUnhide()" class="=tdText" /></>
function HideUnhide() {
var grid = $find("<%= RadGrid1.ClientID %>");
grid.get_masterTableView().hideColumn(8);
grid.get_masterTableView().hideColumn(9);
grid.get_masterTableView().hideColumn(10);
}
I am trying to include condition in the function where I can change the text from Unhide to Hide and depending on the text Unhide the columns in the else part but that doesn't seem to work.
Currently this code can only hide unhidden columns.
Please help.