0

There is some code like this :

if ( bValid ) { 
      $( this ).dialog( "close" );
$("#btnExcel").show(); }

and .aspx look like :

  <form id="form1" runat="server">
                    <input id="inpHide" type="hidden" runat="server" />
                    <asp:Button ID="btnExcel" runat="server" Text="Excel" AccessKey="E" BorderWidth="0px"
                        OnClick="btnExcel_Click" ToolTip="Excel" Visible="false" />
                    </form>

`bValid` is some part of code

Why this doesnt work ? What can be done to work it out. To make button visisble ?

may be its not accessible because :

var button = $('#btnExcel')[0]; 
                        alert(button);

shows : undefined !

Looking for help.

4 Answers 4

5

You can't have the button as Visible="false" on the server side. That is in your ASPX page you need to have it Visible="true" because otherwise the button is not rendered to html.

You could set the style attirbute (or CssStyle attirbute) on your button to style="display:none;" and then things will work

<asp:Button ID="btnExcel" runat="server" Text="Excel" AccessKey="E" BorderWidth="0px"
                        OnClick="btnExcel_Click" ToolTip="Excel" Visible="true" style="display:none;" />
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Visible="false" To Visible="true" Right ??
Yes, and then set the style attribute as I've shown in the code in my answer. That is style="display: none;"
0

Can you set the button's display to none?

Comments

0

Thats because the IDs of server controls generated by ASP.Net is different in the browser. View the HTML source in the browser, find the correct control ID and use that in the jQuery code. You can also try ClientID function of ASP.Net

See this for more: http://forums.asp.net/p/1522697/3664258.aspx

1 Comment

The button is not rendered to html since it has been set to false on the server side. ASP controls when set to false are not rendered.
0

btnExcel will be mangled since its a server side control.

Obtain the mangled id as document.getElementByid(<%=btnExcel.ClientID%>)

1 Comment

There will be no button in fact (in html), since it's Visible property is false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.