Posted by rameshch on July 10, 2008
My button is in user control and i want to hide the button on page based on the differnts events.
it can be solved by the like this
on user control we need to write the function as
‘<%=btnShow.ClientID %>’).disabled=true ;}
function EnableButton() {document.getElementById(‘<%=btnShow.ClientID %>’).disabled=false ; }
function HideReportToExcel() { document.getElementById(‘<%=btnReportToExcel.ClientID %>’).style.visibility = “hidden” ; }
function ShowReportToExcel() {
document.getElementById( ‘<%=btnReportToExcel.ClientID %>’).style.visibility = “visible” ; }
on button we have to mention the style has
<asp:Button ID=”btnReportToExcel” runat=”server” Text=”Report To Excel” ValidationGroup=”submit” style=”visibility:hidden;“ />
another way
function ShowReportToExcel() {
document.getElementById( ‘<%=btnReportToExcel.ClientID %>’).Add.style(display, ’ ‘) ; }
function HideReportToExcel() {
document.getElementById( ‘<%=btnReportToExcel.ClientID %>’).Add.style(display, ’none ‘) ; }
<asp:Button ID=”btnReportToExcel” runat=”server” Text=”Report To Excel” ValidationGroup=”submit” style=”display:none;” OnClick=”OnClick_ReportTOExcel”/>
<asp:Button ID=”btnReportToExcel” runat=”server” Text=”Report To Excel” ValidationGroup=”submit” style=”display:none;” OnClick=”OnClick_ReportTOExcel”/>
on the code behind call this
string script = “if(document.getElementById(‘” + pnlConsumption.ClientID + “‘) != null) { document.getElementById(‘”+ pnlConsumption.ClientID + “‘).style.display=’none’; HideReportToExcel();}”;
ScriptManager.RegisterStartupScript(Page, GetType(), “hidegrid”, script, true);
This entry was posted on July 10, 2008 at 7:19 pm and is filed under Ajax and javaScript.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.