Using an ASHX generic handler with C# in a classic web form app on a master page to render a report via a ajax call

The QUESTION:
How do I get the ashx handler to work with the master page to generate a report when the user clicks on the hyperlink.
I can get it to work if I just route the hyper link control directly to the ashx page, but I eventually need to add code to block the UI while this report being generated.  In the ajax I am thinking I need to do some type of action to force the browser
to kick out the report.. Just not sure...
I have a master page with the following code:
<script type="text/javascript">
function startReport(result) {
$.ajax({
url: "HTTPHandlers/TagExportHandler.ashx",
context: document.body,
success: function(){
alert("done");
//Eventually put code to block UI and etc while report is rendering...
</script>
In the markup I have a asp:hyperlink control...
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/HTTPHandlers/TagExportHandler.ashx" OnClick="startReport('');">Tag Export 2</asp:HyperLink>
Then I have a ASHX control that does the following..
public void ProcessRequest(HttpContext context)
using (var db = new TIPWebITDataContext())
string _exportContent = "";
int[] userDepartments = ((User)HttpContext.Current.Session["currentUser"]).Departments.ToArray();
List<TagDetailsDepartments> tagsModelCsvDepartmentses = null;
List<TagDetailsNonDepartments> tagModelCsvNonDepartmentses = null;
var data = GetTagDetails(db, "");
CsvContext cc = new CsvContext();
using (var writer = new System.IO.StreamWriter(context.Response.OutputStream))
CsvFileDescription output = new CsvFileDescription
QuoteAllFields = true,
EnforceCsvColumnAttribute = true
context.Response.AddHeader("content-disposition", "attachment; filename=TagExport.csv");
context.Response.ContentType = "text/csv";
if (userDepartments.Count() > 1)
tagsModelCsvDepartmentses = ((IQueryable<TagDetailsDepartments>)data).ToList();
cc.Write(tagsModelCsvDepartmentses.ToList(), writer, output);
else
tagModelCsvNonDepartmentses = ((IQueryable<TagDetailsNonDepartments>)data).ToList();
cc.Write(tagModelCsvNonDepartmentses.ToList(), writer, output);
context.Response.StatusCode = 200;
cc = null;
writer.Flush();
output = null;
data = null;
tagsModelCsvDepartmentses = null;
tagModelCsvNonDepartmentses = null;
userDepartments = null;
// context.Session.Add("TagExport", "Complete");
GC.Collect();
GC.WaitForPendingFinalizers();
Warren

Hi,
please move your problem to asp.net forums :> forums.asp.net
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

Similar Messages

  • Suppress members with certain UDA in Planning Web Forms

    Hi All,
    Can someone suggest me a way to suppress members with certain UDA's in Planning Web Forms. We have few members (associated with a UDA) which we don't want to show up if we do a IDESC of a member, is there any way to address this.
    Thanks...

    The only way you could do this is if you made the form suppress missing and/or suppress block and then copied data into BegBalance of the accounts you wanted to show. You can also hide that column although hidden columns still show for SmartView in all released version through 11.1.1.2.
    Planning doesn't have a way to make use of UDA's with forms in any released version although it would be a really nifty feature.
    Regards,
    John
    http://www.metavero.com

  • Using a uk tesco sim, with a french 2600 classic? ...

    FROM FRANCE, not UK,
    I just tried an old Tesco sim (from an ancient Brit cellphone, both dating around 2003-5)
    in my french, new Nokia 2600 Classic. This old sim has lasted vey well - and still has £2 + credit to use.
    It seems to work - more or less (I have to put a country code on ALL numbers - for France too)
    It picks up BT -  and then - Bouygues fr.
    Id like to top it up and carry on with it - in the new phone - but I do not know if there are likely to be probs with it.
    Does anyone have any thoughts on that?
    Thanks for reading my Q;!!:womanvery-happy:
    H.
    Solved!
    Go to Solution.

    No problem

  • Use a C++ WinRT Component with external LIB in a C# Universal App

    Hello,
    I created two projects : a C++ WinRT Component project and a C# Universal app that references directly the C++ project.
    If I call a method from my class in the C++ Windows Runtime Component project from C# it's working fine.
    I got the following error in the C# Universal App project when I reference an external LIB in the C++ project : "Additional information: The specified module could not be found. (Exception from HRESULT: 0x8007007E)".
    Do I need to reference somehow the LIB (I got a DLL with the LIB too) in the C# project too?
    Thanks,
    Adrien.

    Hi Adrien,
    What do you mean by "reference an external LIB in the C++ project", the C++ project you mentioned here is a normal C++ project?
    As I know we have to check the option support in Windows Store App.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • HT201272 There were not enough pages for all apps to appear; so now I've made more room with folders but still can't get app to appear on pages.

    Need to make app appear on iPhone screen; previously, wasn't enough pages, but now have created folders.  Still app won't show up unless I search for it.

    Thanks Tom, that's very helpful (and quick too).
    I was using Custom text so yes, that explains it.
    Ah wait, I can make the text primary storyline just for applying the transition and then go back to where my other clips are primary storyline? That would solve the issue (and some others, too)! Great!
    I will play around with the copy/paste.
    Oh, one more thing. This seemed to be a bug, a very frustrating one .
    I made my item in several projects before glueing the 5 parts together. The first two I could just do by copying and pasting from another project. However, the 3rd copy-paste just wouldn't work. FC continued to paste the former edit. Even when I quit FC and restarted. Even when I deliberately emptied the clipboard by pasting some line of text from another program. Even when I turned the part of the project that I wanted to transfer into a compound clip. In the end I solved it by exporting the project and importing it as a file into the Events so that I could paste it, and this worked. (2nd time round because the first time all my text effects had resetted).
    The next copy-paste, part 5 of the video, worked fine again. I've no idea why this happened, but it is probably too specific.
    Anyway, thanks again Tom, greatly appreciated.

  • Slow InitialContext with Weblogic 6.1 and Web Start App.

    All,
    I have a Swing-based client app that makes EJB calls on a Weblogic 6.1sp2
    server. It works great as a standalone app run from the command line. The
    problem is when I deploy it using Java Web Start. The 'new
    InitialContext(props)' call takes from 5-20 seconds. This is on a single
    user development machine with the server and client running on the same
    machine.
    When I run it from the command line the initial context only takes 1-2
    seconds to create. This is using the exact same .jar file used in the Web
    Start case.
    The Web Start environment is somewhat different than command line clients.
    I think it is similar to the applet sandbox environment (security,etc).
    Other than this, the client/server interaction speed is good (they should
    be since they are on the same machine!). Any ideas?
    System particulars:
    Weblogic 6.1sp2. Native IO.
    Host=127.0.0.1 (Reverse DNS Lookup disabled in server).
    Java 1.3.1
    Java Web Start 1.0.1
    Windows NT 4.0sp5
    Thanks for any help.

    I have some more details. If I sign the .jar file and give the app AllPermissions, then it connects quickly (well, about 1s).
    Any ideas on which specific permissions will be needed to make this connection quickly?

  • Generic Extractors with Fm / Finding out tables used

    Hello Gurus,
    for a requirement, i would like to find out the table used in a generic extractor with function module.
    I can see the structure with the objects used but not the tables where they are from.
    How can i find that out?
    Thank you
    Pat

    Hi Gilo ,
    The best way to find out the tables used in the function module will be to analyze the code . Check all your Select Statements in the code and see the tables being used there .
    Sometimes in the code , we use standard function modules from the ECC. Check those standard FMs also and see what table they are using .
    Hope the above reply was helpful.
    Thanks & Regards,
    Ashutosh Singh

  • I bought a used macbook pro that came with xcode

    I bought a used macbook pro that came with xcode, this means I can develop Apps but to publish in App Store needed pay developer fees? Or must pay these fees from now?

    All you have are the basic tools. Without a paid program in your name, you cannot distribute apps to the store.
    See iOS Developer Program

  • Lost Page on when you should use MVC vs when you should use web forms

    I read a page last week.  I think it was on MSDN.  It was talking about the relative merits of MVC and web forms.  However, unlike the page http://msdn.microsoft.com/en-us/library/dd381412.aspx,
    which merely states the advantages and disadvantages of each format, this page went on to state something like:
    You should use MVC:
    when building web apps that do this
    when you web app needs that
    when you are doing the other
    You should use web forms:
    when building these other kinds of web app
    when your web app does this other thing
    when your web app does this.
    Does anyone know the page to which I am referring?
    (Oh and since when did it become impossible to paste anything into a question or reply block in MSDN forums.  This makes it very difficult to paste in page links.)
    Also I am not seeing an appropiate forum in my forums dropdown list.  So if a moderator wants to move it to the right forum I would appreciate it.
    Edward R. Joell MCSD MCDBA

    @Darnie Graceline Selvamary Thangalazar
    The first link is not what I was looking for as it tells the difference between MVC and Web Forms but not which is better for what.
    The second link does get more into which is better in certain situations but doesn't really analyze each type of project and specify that this is good for web forms and this is good for MVC.  However, it does provide some ways to analyze if your
    "situation" would be best served by using web forms and which would be best served by using MVC. 
    It specified that if reaction time is an issue then MVC is the answer.  This is good because with our excruciatingly slow network we need apps that take inherantly as little time as possible to load.
    I took another look at the link provided by gaurav.  Turns out that link has a link to an article by Dino Espisito which actually has the statement that I referred to above i.e. if your app has a lot of busines data.  After two years, that
    is as much as I remember of that page.  So in fact indirectly gaurav found the page I was looking for.
    Too bad I did not re-read this link when I started the current project, though.  One thing each of them says is that if your team (in this case me) has not had much experience in handling html elements directly then MVC is not a good fix for them. 
    For the last 6 months theis has been a major learning process in using JQuery, AJAX, and MVC to accomplish tasks which I've could have done using server controls and web forms with my eyes closed.  Too bad they don't make MVC so that you can use server
    controls with it.
    However since this thread is so old and unlike "Whose Line is it Anyway?" the points
    do matter. I am going to award the answer to gaurav.  Thanks everyone for providing some very interesting links on MVC.
    Edward R. Joell MCSD MCDBA

  • Composite Web form - Issue with Ordering of dimensions in page section

    Hi,
    I have 2 simple web-forms having same dimensions in page section and in same order. When I create the compisite web form with these 2 simple webforms and view the same, it come in different order.
    Is there any way to get the dimensions in required order / or any solution to this.
    Thanks and Regards,
    VM
    Edited by: VM on Nov 10, 2010 12:35 AM

    Hi,
    What version are you using ?
    Regards

  • Passing parameters to a report via URL : using 'like' and '%' ?

    Hi,
    I have created a report by sql query, and I'm calling it by the means of a URL with a '.show' extension, and then I can specify as many parameters as I wish.
    In my case I use a string as a bind variable ans I would like to pass it as a condition to render the report.
    Thus I tried to use that :
    "[call_url].show?p_arg_names=_[...]_cond&p_arg_values=like&p_arg_names=_[...]_[bind_variable]&p_arg_values=[xxx]"
    To be able to use it I have to add a '%' at the end of it, so that I get all the rows beginning with the letters I specified, ie 'xxx' could be 'A%', so that I get all the rows beginning with an A.
    The problem is that this character is not effective. I succeeded with the '_' character, but it brings a limitation to the length of the field, and it's not what I want. I also tried this : "...p_arg_values=A'&'%'", but I didn't manage to make it work !
    Any idea appreciated !
    Regards,
    gael.

    Hi Gael,
    your URL is made up of :
    [ProcedureName]?[parameter1]=[value1]&[parameter2]=[value2]
    creating URLs like this can have problems especially with spaces and punctuation.
    the answer is a FORM
    the following will create a hidden form :
    FORM ACTION="[ProcedureName]" METHOD="POST" name="F1"
    INPUT type="HIDDEN" name="[parameter1]" value="[value1]"
    INPUT type="HIDDEN" name="[parameter2]" value="[value2]"
    /FORM
    you can set the values in the form using:
    document.F1.[parameter1].value="abc123%%&&$$!";
    document.F1.submit();
    will submit the form and the PL/SQL procedure should receive the text as it was contained in the form.
    the only characters that can now cause problems are :
    " as it delimits the field.
    ' as it may cause problems in PL/SQL.
    \ as it is a special character.
    Regards Michael

  • Master pages won't open with double click

    What am I missing? I've used Indesign for years. Have CS6 now. When I double click on a master page, it won't open. This happens with old documents and with new ones as well.
    Barb

    I realized that I can't open anything with a double click, not just InDesign. In searching for an answer, I found an answer. When I installed a new mouse, I turned the speed on everything to high, fast, super speedy. When I slowed down the double click speed, I could open anything. Whew!
    I solved the problem.  If you go to System Preferences > Accessibility > Mouse and Trackpad -  You can set the speed of the double click to be much slower.

  • Apply footer to topics without using master page

    Does anyone here know of a way to apply a footer to multiple topics without using a master page? I'm using TC3 with a linked Frame book.
    Thanks in advance for any help!

    There is probably a better way to do this, but I found a work around.  I set the fields on the master page to "Use Global Data" in the Binding tab.  This means that the value for that field will be the same for any field with the same name.  Then, on my main page, I have a hidden field with the same name that I can populate with ColdFusion and the value will also show in the master page.
    If anyone has a more elegant way to do this, please respond.  I am new to LiveCycle and I'm sure there are a lot of features that I am not aware of that could help me.

  • Exeperience in using Web Form

    After using and developing Web Form for a few months, the
    following are my experience. Hope that someone can help me to
    sort out the problem.
    1. Start up time is extremely slow.
    Referring to some document, it can be solved by customizing the
    jar file (but I don't know how to do that) but I just think that
    I am developing my application in high speed intranet, is it
    useful ?
    2. Percentage of successful browse up the web form is 50/50.
    I am now using Jinitiator with ie5, sometimes it can browse up
    and sometimes it can't. In addition, since the startup time is
    very very slow, I don't know if it has fail or it is still
    loading up the form. I try to use the debug function of Jinit,
    but the result must be "fail to browse up the form". Can anyone
    teach me how to monitor the whole process of browsing up the
    form ?
    Rgds,
    Edward
    null

    See if you have 'enable ad-hoc mode' option available in your dataform design other options(it depends on the version you are in)?
    If yes, users can select the attributes and filter the base membrs associated.
    --Ram                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Using Adobe Muse to create master pages

    Hi,
    Is it possible to use Adobe Muse to create master pages for Sharepoint 2013?
    The Muse product creates the Javascript, css and html files, with the images etc.
    The Muse product looks ideal to create the master pages with no coding required.
    Nick

    For SharePoint 2013, yes you could absolutely use this tool to create your HTML (this post is in the 2010 forum, so just making sure).  In SP 2013 you can use the new Design Manager to upload HTML which then gets converted to a .NET Master Page. 
    So long as Muse turns out valid HTML, you should not have an issue.
    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

Maybe you are looking for

  • How to create a QUEUE in Oracle XE

    Hi everybody, Can some1 tell what r d steps i need to follow in order to create a queue in Oracle XE database Thanks

  • Materialized View-OAF

    Hi all, In a search page I used a materialized view instead of normal select... that takes for about 2.5 seconds. I can compile and it works well on my computer. But when I deploy the project to Oracle I get "unexpected error" only when adress is act

  • Through code, text value is not reflecting on pdf document

    Hi, Overview of issue. I layed few textbox(annotaion) on pdf and through .net code i am trying to update the value  but it is not reflecting on pdf document. code as below Acrobat.AcroApp AcrApp = new Acrobat.AcroApp(); Acrobat.AcroAVDoc AcrAvDoc = A

  • Pdf print and view using swing

    hello i am created one pdf file from original pdf file with data using itext library,but now my problem is how can view this file and print this pdf file using swing printing api

  • 1020 acting odd

    Hi all, Hope this is the correct place to post this... I tried using recovery tool on two PCs, it downloads the software to 99.99% then says there is a network error and wont install - or connect or anything. My 1020 is misbehaving. I receive notific