Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
if i write btnExcel.Enabled = true; after below statement then why not executed.

Collapse | Copy Code

Rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Report");


ie.

Collapse | Copy Code

Rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true, "Report");

btnExcel.Enabled = true;



ok someone gave me solution

that is

Collapse | Copy Code

It overrides the response object so the disabled portion of the button is not getting included in the response object. so use javascript before or after this event to disable the button.

i use javascript before or after this event to disable the button.
still not working?
Posted
Comments
Ravinder_Verma 2-May-12 7:14am    
Are you download any file with the help of this code?
ZurdoDev 2-May-12 10:36am    
Show the JS that you used.
Member 8861818 3-May-12 2:34am    
this javascript write in btn click event before below statement
Rpt.ExportToHttpResponse(ExportFormatType.Excel, Response, true,"Report");

string JScript = "javascript:Btn_Click()";
ScriptManager.RegisterStartupScript(this, this.GetType(), "JScript", JScript, true);

.aspx page

function Btn_Click()
{

var BtnEx=document.getElementById("ctl00$ContentPlaceHolder$btnExcel");


BtnEx.disabled=false;

}


ZurdoDev 3-May-12 9:01am    
You have to have JS execute first. You are trying to add JS into the Response Object but it is being overwritten. So, add an OnClientClick event to your ASP.Net button and put the JS there.

1 solution

instead of setting enable, disable property of Button use style.dispaly
<asp:button id="bt1" runat="Server" style="display: none;" xmlns:asp="#unknown">
Do not use Visible property of button. after that in your .js file you need to do these codes :-
document.getElementById('<%= bt1.ClientID %>').style.display = "block";
 
Share this answer
 

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