Archive

Archive for June, 2007

How to loading meesage for reportviewer inside updatepanel

June 21, 2007 Leave a comment
Whenever u keep report viewer inside update panel.u may not able to see Loading message of report viewer. to solce this issue i try to write code like this
 var prm = Sys.WebForms.PageRequestManager.getInstance();
   prm.add_endRequest(endRequestHandler);

 function endRequestHandler(sender, args)
        {
            if( postBackElement.id == "<%=lnkBtnRun.ClientID%>")
           {
           var loadMesage=document.getElementById("<%=rptVwrReport.ClientID%>"+"_ctl03");
           loadMesage.style.display = "block";
           return;
            }

the above gets executed after every asychronus postback occurs.that is on rendering onto clientside.  here lnkBtnRun is button whch make report to run inmy case u can keep report viewer id  as postbackElement Id..
rptVwrReport is my reportviewer name which i had given in aspx page

_ctl03 is ID of Loading Message of reportviwer…

Loading message ‘s id  is reportviewername_ctl03.since inorder to make my code more genric i tried to write like this ("<%=rptVwrReport.ClientID%>"+"_ctl03");

this is will show loading message upon every asynchronous postback.

How to render report in excel format whenver reportviewer is placed inside updatepanel.

June 21, 2007 Leave a comment
Whenever we try to keep report viewer in update panel export button of report viewer doest work properly.Whenever you go to child report and try to export ,u will be shocked to see that report exported one is parent report not child report.u cant export child report whenever u try to keep report viewer inside update panel.Solution is try to use custom rendering provide by report viewer ..I.e  u need to keep dropdownlist outside update panel.whenever u select an item in dropdownlist selected index event handling is fired.in tht try to use reportviewer.render() method …… it will return byte array .write those byte on to a file of particular format and use

            Response.ContentType = "application/ms-excel";
            Response.AddHeader("content-disposition", "attachment; filename=report.xls");
            Response.WriteFile()

dont forget to keep reponse.close;

Categories: ASP.NET

How to make reportviewer loading message ..when reportviewer is kept inside updatepanel

June 21, 2007 Leave a comment
Actually there is Bug in Microsoft AJAX 1.0 .Whenever we try to keep report viewer inside update panel.It is not working Properly with javascript errors ,unable to take print ,unable to export child report etc. In order to get print of report  from report viewer,initially run  a dummy report on page Load .so that u can print report any point of situation.You also face some problems like javascript error are fired…In order to make page with out any javascript errors,try to run report on page load r  else make report body of report viewer to false.This prevent javascript errors.

We get this errors because report viewer requires entire page post back.Errors are because writing inline jaavscript code for report viewer.U should not have inline script to be written for control within updatepanel.This is bug from reportviewer and ajax.to solve this error we need to wait for next version of VS .

With regards,
Mahender

%d bloggers like this: