Search Results

Search found 4141 results on 166 pages for 'render'.

Page 8/166 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Rails Layout Rendering with controller condition

    - by Victor Martins
    I don't know what's the best way to doing this. On my application.html.erb I define a header div. My default controller ( root ) is a homepage controller. And I wish that if I'm at index of the homepage the header is rendering with some content, but all other controllers render another content inside that header. How can I make a condition in that header div to render different content based on the controller that's being rendered?

    Read the article

  • Pylons FormEncode @validate decorator pass parameters into re-render action

    - by joelbw
    I am attempting to use the validate decorator in Pylons with FormEncode and I have encountered an issue. I am attempting to validate a form on a controller action that requires parameters, and if the validation fails, the parameters aren't passed back in when the form is re-rendered. Here's an example. def question_set(self, id): c.question_set = meta.Session.query(QuestionSet).filter_by(id=id).first() c.question_subjects = meta.Session.query(QuestionSubject).order_by(QuestionSubject.name).all() return render('/derived/admin/question_set.mako') This is the controller action that contains my form. The form will add questions to an existing question set, which is identified by id. My add question controller action looks like this: @validate(schema=QuestionForm(), form='question_set', post_only=True) def add_question(self): stuff... Now, if the validation fails FormEncode attempts to redisplay the question_set form, but it does not pass the id parameter back in, so the question set form will not render. Is it possible to pass the id back in with the @validate decorator, or do I need to use a different method to achieve what I am attempting to do?

    Read the article

  • Setting encoding in Grails controller's render method

    - by Philippe
    Hello, I'm trying to build an RSS feed using Grails and Rome. In my controller's rss action, my last command is : render(text: getFeed("rss_2.0"), contentType:"application/rss+xml", encoding:"ISO-8859-1 ") However, when I navigate to my feed's URL, the header is : <?xml version="1.0" encoding="UTF-8"?> <rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> ... Does anyone have a clue about WHY the encoding is UTF-8 when I set it to ISO-8859-1 in the render method ??? Thanks for your help !

    Read the article

  • How to manually render a Django template for an inlineformset_factory with can_delete = True / False

    - by chefsmart
    I have an inlineformset with a custom Modelform. So it looks something like this: MyInlineFormSet = inlineformset_factory(MyMainModel, MyInlineModel, form=MyCustomInlineModelForm) I am rendering this inlineformset manually in a template so that I have more control over widgets and javascript. So I go in a loop like {% for form in myformset.forms %} and then manually render each field as described on this page http://docs.djangoproject.com/en/dev/topics/forms/#customizing-the-form-template The formset has can_delete = True or can_delete = False depending on whether the user is creating new objects or editing existing ones. Question is, how do I manually render the can_delete checkbox?

    Read the article

  • Rendering form on the fly from XML in flex

    - by kartikkowligi
    Hi, I have an xml code something like this <root> <render> <head> <transition id="fadeIn" type="fade" subtype="" dur="3s"/> <transition id="fadeOut" type="fade" subtype="" dur="3s"/> <layout> <root-layout width="480px" height="360px" backgroundColor="0"/> <region id="rootRegion" dur="15s"> <region id="background" soundLevel="100%" top="0px" left="0px" width="480px" height="360px" z-index="0"/> <region id="foreground" soundLevel="100%" top="0%" left="0%" width="480px" height="360px" z-index="1"/> </region> </layout> </head> <body> <par region="background" begin="0s"> <img> <meta name="assetsource" content="stock"/> <src>http://s3.amazonaws.com/JivoxStockImage/000003296736.jpg</src> <width>102.49999999999999%</width> <height>97.5%</height> <left>0%</left> <top>0%</top> <clipBegin/> <clipEnd/> <begin>0s</begin> <dur>15</dur> </img> <audio> <meta name="assetsource" content="stock"/> <src>http://audio.mp3</src> <clipBegin/> <clipEnd/> <begin>0s</begin> <dur>15s</dur> </audio> </par> <par region="foreground" begin="0s"> <img> <meta name="assettype" content="user"/> <src>http://image.png</src> <width>20%</width> <height>20%</height> <left>41.5%</left> <top>25.555555555555557%</top> <begin>2s</begin> <dur>10s</dur> <id>BA6B7CF0BD9080CAD7A02199483224EA61A6E08A</id> </img> </par> </body> </render> <form> <map formId="BA6B7CF0BD9080CAD7A02199483224EA61A6E08A" type="image" label="Logo" /> <map formId="F635A9123082A15834389030382683C55EB29E75" type="text" label="Company Name" /> </form> </root> Here I need to match formId in 'form' with that of 'id' in 'render' and create the form dynamically in flex. I am able to get the xml file via the httpservice. All I need to know is how to match it and render the form dynamically!!

    Read the article

  • Render a view as a string

    - by Dan Atkinson
    Hi all! I'm wanting to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user. Is this possible in ASP.NET MVC beta? I've tried multiple examples: RenderPartial to String in ASP.NET MVC Beta If I use this example, I receive the "Cannot redirect after HTTP headers have been sent.". MVC Framework: Capturing the output of a view If I use this, I seem to be unable to do a redirectToAction, as it tries to render a view that may not exist. If I do return the view, it is completely messed up and doesn't look right at all. Does anyone have any ideas/solutions to these issues i have, or have any suggestions for better ones? Many thanks! Below is an example. What I'm trying to do is create the GetViewForEmail method: public ActionResult OrderResult(string ref) { //Get the order Order order = OrderService.GetOrder(ref); //The email helper would do the meat and veg by getting the view as a string //Pass the control name (OrderResultEmail) and the model (order) string emailView = GetViewForEmail("OrderResultEmail", order); //Email the order out EmailHelper(order, emailView); return View("OrderResult", order); } Accepted answer from Tim Scott (changed and formatted a little by me): public virtual string RenderViewToString( ControllerContext controllerContext, string viewPath, string masterPath, ViewDataDictionary viewData, TempDataDictionary tempData) { Stream filter = null; ViewPage viewPage = new ViewPage(); //Right, create our view viewPage.ViewContext = new ViewContext(controllerContext, new WebFormView(viewPath, masterPath), viewData, tempData); //Get the response context, flush it and get the response filter. var response = viewPage.ViewContext.HttpContext.Response; response.Flush(); var oldFilter = response.Filter; try { //Put a new filter into the response filter = new MemoryStream(); response.Filter = filter; //Now render the view into the memorystream and flush the response viewPage.ViewContext.View.Render(viewPage.ViewContext, viewPage.ViewContext.HttpContext.Response.Output); response.Flush(); //Now read the rendered view. filter.Position = 0; var reader = new StreamReader(filter, response.ContentEncoding); return reader.ReadToEnd(); } finally { //Clean up. if (filter != null) { filter.Dispose(); } //Now replace the response filter response.Filter = oldFilter; } } Example usage Assuming a call from the controller to get the order confirmation email, passing the Site.Master location. string myString = RenderViewToString(this.ControllerContext, "~/Views/Order/OrderResultEmail.aspx", "~/Views/Shared/Site.Master", this.ViewData, this.TempData);

    Read the article

  • Changing Render Kits in Browser

    - by John
    I'm working on a project to develop a cross-browser testing web app. Simply put, I'm tired of having to maintain multiple browsers on the same system and IE in VMware solely for the purpose of testing. Does anyone know if there is any way to change the render kit programmatically? For example, if I insert a URL, I would be able to load the URL and switch the browser render within a frame of some assortment. I am experienced with PHP, JS, and RoR if there is a solution using any of those. Thank you! John

    Read the article

  • JSF Render response programatically

    - by Shamik
    I have one parent page with a parentManagedBean (attached to Session Scope). On click of a button on this parent page, one popup comes which has a childManagedBean (attached to Request scope). Now ChildManagedBedan holds a reference to parentManaged bean thru JSFs managed Property feature. On this popup window, user selects some option which populates a large value object class. I use the managed property of childMnaagedBean to set the values from this large object to that of parentmanagedbean. Problem is - The parent page shows a link, on click of which a popup comes, on selection of the popup, the popup disappears and set the values to the parentManaged bean.So far so good, but the newly set values need to appear on the parent page. This is where I am stuck. How to programatically render the master page/render page when I am at the child managed bean... is there a way I can get handle of the parent page and refresh it ?

    Read the article

  • asp.net mvc 1.0 - how to render a partial view as a string

    - by Chev
    Hi There I need to render a partial view to a string within a controller action. I have the following sample code, but the ControllerContext.ParentActionViewContext does not seem to exist in mvc 1.0 // Get the IView of the PartialView object. var view = PartialView("MyPartialView").View; // Initialize a StringWriter for rendering the output. var writer = new StringWriter(); // Do the actual rendering. view.Render(ControllerContext.ParentActionViewContext, writer); Any tips greatly appreciated.

    Read the article

  • Rails: render a partial from a plugin

    - by Sam
    I'm getting a missing template error after I try rendering a partial from a plugin. I have included the files with the following: %w{ models controllers helpers views }.each do |dir| path = File.join(File.dirname(__FILE__), 'app', dir) $LOAD_PATH << path ActiveSupport::Dependencies.load_paths << path ActiveSupport::Dependencies.load_once_paths.delete(path) end The Models are getting loaded, but as for other things I'm not sure what's going on. The helpers are not getting loaded too because I just copied the contents of the partial from the plugin instead of the render :partial = and then it came up with a helper error. Question is how to be able to :render :partial = from the views folder in my plugin

    Read the article

  • Render Html from a lambda in MVC

    - by Thad
    I have the following code to generate a list and will allow developers to customize the output if needed. <% Html.List<MyList>(item => item.Property).Value(item => return "<div>" + item.Property + "<br/>" + item.AnotherProperty + "</div>").Render() %> This is not ideal, how can I allow the developers to add the html similar to other controls. <% Html.List<MyList>(item => item.Property).Value(item => %> <div><%=item.Property%><br/><%=item.AnotherProperty%></div><%).Render() %> This way is much cleaner and standard with the rest of mvc.

    Read the article

  • Cocoa Touch: Why doesn't UINavigationController render 'Back' button?

    - by Joshua
    When I push a view controller it animates properly and slides in, the only problem is that no 'Back' button is rendered up top.The back button is still there, I can still tap it, it just doesn't render on the screen. This behavior is identical in both the simulator and on multiple devices. Is this a known issue or bug? Using 3.1.3 of the iPhone SDK. More information: It renders it for further levels, just not on the second level of nav controller. So Main Page (No back button - OK). Second level page (back button, but doesn't render - not OK). Third level page (Back button there and rendering - OK).

    Read the article

  • Tool to measure Render time

    - by Noob
    Hi Folks, Is there a tool out there to measure the actual Render time of an element(s) on a page? I don't mean download time of the resources, but the actual time the browser took to render something. I know that this time would vary based on factors on the client machine, but would still be very handy in knowing what the rendering engine takes a while to load. I would imagine this should be a useful utility since web apps are becoming pretty client heavy now. Any thoughts?

    Read the article

  • LinkButton child controls render

    - by Alex
    Hi. I want to have a LinkButton that adds 'span' tag around the text. protected override void Render(HtmlTextWriter writer) { Text = String.Concat("<span>", Text, "</span>"); base.Render(writer); } It's works perfectly, but only if I add text like this: <cc:TestLinkButton ID="TestLinkButton" runat="server" Text="SomeText"> </cc:TestLinkButton> If I want to add some image I will write something like this: <cc:TestLinkButton ID="LinkButton1" runat="server"> <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/icon_holiday.png" BorderWidth="0" /> SomeText </cc:TestLinkButton> In this case Text property will be empty, because actualy "SomeText" is child control property. So question is is how to add tag around child controls.

    Read the article

  • Error 500 on template.render() with jinja2

    - by Asperitas
    I am working on playing with some Python to create a webapp. At first I put the HTML in a string, using %s to fill certain elements. That all worked perfectly. Now I want to put the HTML in a template, so I followed this tutorial. My code looks like this (I deleted irrelevant code for this error): import codecs import cgi import os import jinja2 jinja_environment = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__)))) class Rot13Handler(webapp2.RequestHandler): def get(self): template = jinja_environment.get_template('rot13.html') self.response.out.write(template.render({'text': ''})) When I replace just template.render({'text': ''}) a random string, the program works fine. I did add the latest jinja2 library to my app.yaml, and naturally my rot13.html does exist with the {{ text }} added. So could anyone please help me in the right direction? I don't know why it's going wrong.

    Read the article

  • Render multiple layers in XNA

    - by Charles
    I'm using XNA, and I've run into a little problem. I need to support multiple layers, each with a distinct z order (I call these "viewports"). A picture is worth a thousand words, so here's what it should look like: There are several things to notice here. Sprites do not render outside of their viewport, as you can see with Sprite B. Also, notice how the viewports are rendered - it's very similar to "layers" in Photoshop. Although Sprite C is has a z order of -1000, C still renders above Sprite A because its viewport's z-order is a greater than A's viewport's z-order. There's one last detail that I couldn't display very well in the above picture. Each viewport needs to optionally render a color over its region of the screen - you could think of it as a "tinting" affect. I'm completely at a loss when it comes to doing this the best way in XNA, so I could really use a short snippet of C#/VB.NET code that demonstrates this in action. Any help would be greatly appreciated.

    Read the article

  • How do I pass object values with render :action => 'new'

    - by PlanetMaster
    Hi, In an app I have the following: def new @property = Property.new(:country_id => 1, :user_id => current_user.id, :status_id => 'draft') end def create @property = Property.new(params[:property]) if @property.save flash[:success] = t('The_property_is_successfully_created') redirect_to myimmonatie_url else flash.now[:error]=t("The_property_could_not_be_created") render :action => 'new' end end When an error accors, the line render :action = 'new' gets executed, but the my form gives an error: user blank country blank These cannot be blank (defined in model), meaning this code: @property = Property.new(:country_id => 1, :user_id => current_user.id, :status_id => 'draft') is not executed anymore. What is the reason and solution? Thanks!

    Read the article

  • How can I render multiple windows with DirectX 9 in C++?

    - by Friso1990
    I'm trying to render multiple windows, using DirectX 9 and swap chains, but even though I create 2 windows, I only see the first one that I've created. My RendererDX9 header is this: #include <d3d9.h> #include <Windows.h> #include <vector> #include "RAT_Renderer.h" namespace RAT_ENGINE { class RAT_RendererDX9 : public RAT_Renderer { public: RAT_RendererDX9(); ~RAT_RendererDX9(); void Init(RAT_WindowManager* argWMan); void CleanUp(); void ShowWin(); private: LPDIRECT3D9 renderInterface; // Used to create the D3DDevice LPDIRECT3DDEVICE9 renderDevice; // Our rendering device LPDIRECT3DSWAPCHAIN9* swapChain; // Swapchain to make multi-window rendering possible WNDCLASSEX wc; std::vector<HWND> hwindows; void Render(int argI); }; } And my .cpp file is this: #include "RAT_RendererDX9.h" static LRESULT CALLBACK MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); namespace RAT_ENGINE { RAT_RendererDX9::RAT_RendererDX9() : renderInterface(NULL), renderDevice(NULL) { } RAT_RendererDX9::~RAT_RendererDX9() { } void RAT_RendererDX9::Init(RAT_WindowManager* argWMan) { wMan = argWMan; // Register the window class WNDCLASSEX windowClass = { sizeof( WNDCLASSEX ), CS_CLASSDC, MsgProc, 0, 0, GetModuleHandle( NULL ), NULL, NULL, NULL, NULL, "foo", NULL }; wc = windowClass; RegisterClassEx( &wc ); for (int i = 0; i< wMan->getWindows().size(); ++i) { HWND hWnd = CreateWindow( "foo", argWMan->getWindow(i)->getName().c_str(), WS_OVERLAPPEDWINDOW, argWMan->getWindow(i)->getX(), argWMan->getWindow(i)->getY(), argWMan->getWindow(i)->getWidth(), argWMan->getWindow(i)->getHeight(), NULL, NULL, wc.hInstance, NULL ); hwindows.push_back(hWnd); } // Create the D3D object, which is needed to create the D3DDevice. renderInterface = (LPDIRECT3D9)Direct3DCreate9( D3D_SDK_VERSION ); // Set up the structure used to create the D3DDevice. Most parameters are // zeroed out. We set Windowed to TRUE, since we want to do D3D in a // window, and then set the SwapEffect to "discard", which is the most // efficient method of presenting the back buffer to the display. And // we request a back buffer format that matches the current desktop display // format. D3DPRESENT_PARAMETERS deviceConfig; ZeroMemory( &deviceConfig, sizeof( deviceConfig ) ); deviceConfig.Windowed = TRUE; deviceConfig.SwapEffect = D3DSWAPEFFECT_DISCARD; deviceConfig.BackBufferFormat = D3DFMT_UNKNOWN; deviceConfig.BackBufferHeight = 1024; deviceConfig.BackBufferWidth = 768; deviceConfig.EnableAutoDepthStencil = TRUE; deviceConfig.AutoDepthStencilFormat = D3DFMT_D16; // Create the Direct3D device. Here we are using the default adapter (most // systems only have one, unless they have multiple graphics hardware cards // installed) and requesting the HAL (which is saying we want the hardware // device rather than a software one). Software vertex processing is // specified since we know it will work on all cards. On cards that support // hardware vertex processing, though, we would see a big performance gain // by specifying hardware vertex processing. renderInterface->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwindows[0], D3DCREATE_SOFTWARE_VERTEXPROCESSING, &deviceConfig, &renderDevice ); this->swapChain = new LPDIRECT3DSWAPCHAIN9[wMan->getWindows().size()]; this->renderDevice->GetSwapChain(0, &swapChain[0]); for (int i = 0; i < wMan->getWindows().size(); ++i) { renderDevice->CreateAdditionalSwapChain(&deviceConfig, &swapChain[i]); } renderDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); // Set cullmode to counterclockwise culling to save resources renderDevice->SetRenderState(D3DRS_AMBIENT, 0xffffffff); // Turn on ambient lighting renderDevice->SetRenderState(D3DRS_ZENABLE, TRUE); // Turn on the zbuffer } void RAT_RendererDX9::CleanUp() { renderDevice->Release(); renderInterface->Release(); } void RAT_RendererDX9::Render(int argI) { // Clear the backbuffer to a blue color renderDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB( 0, 0, 255 ), 1.0f, 0 ); LPDIRECT3DSURFACE9 backBuffer = NULL; // Set draw target this->swapChain[argI]->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &backBuffer); this->renderDevice->SetRenderTarget(0, backBuffer); // Begin the scene renderDevice->BeginScene(); // End the scene renderDevice->EndScene(); swapChain[argI]->Present(NULL, NULL, hwindows[argI], NULL, 0); } void RAT_RendererDX9::ShowWin() { for (int i = 0; i < wMan->getWindows().size(); ++i) { ShowWindow( hwindows[i], SW_SHOWDEFAULT ); UpdateWindow( hwindows[i] ); // Enter the message loop MSG msg; while( GetMessage( &msg, NULL, 0, 0 ) ) { if (PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } else { Render(i); } } } } } LRESULT CALLBACK MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { switch( msg ) { case WM_DESTROY: //CleanUp(); PostQuitMessage( 0 ); return 0; case WM_PAINT: //Render(); ValidateRect( hWnd, NULL ); return 0; } return DefWindowProc( hWnd, msg, wParam, lParam ); } I've made a sample function to make multiple windows: void RunSample1() { //Create the window manager. RAT_ENGINE::RAT_WindowManager* wMan = new RAT_ENGINE::RAT_WindowManager(); //Create the render manager. RAT_ENGINE::RAT_RenderManager* rMan = new RAT_ENGINE::RAT_RenderManager(); //Create a window. //This is currently needed to initialize the render manager and create a renderer. wMan->CreateRATWindow("Sample 1 - 1", 10, 20, 640, 480); wMan->CreateRATWindow("Sample 1 - 2", 150, 100, 480, 640); //Initialize the render manager. rMan->Init(wMan); //Show the window. rMan->getRenderer()->ShowWin(); } How do I get the multiple windows to work?

    Read the article

  • UAC consent.exe doesn't render when remoting

    - by chief7
    Im using remoted desktop to access a Win7 machine. when I ctrl+shift click an icon or right click to run it as administrator nothing happens. I see that a new instance of consent.exe is added to the processes in windows task manager but nothing is rendered to approve the execution.

    Read the article

  • I love google Chrome, but some non-static pages like Piwik render it unresponsive

    - by gogowitsch
    The web-stat software Piwik stops reacting on mouse clicks after 1-2 seconds. The same is true for Google Maps and Producteev (but GMail and most other pages work like a charm). These rely heavily on JS, and work without Flash. I can click for a very short time period and then the mouse cursor doesn't feel the UI anymore (it doesn't turn into a I over input fields, though it moves; if the freeze occured while the pointer was over an input field, the cursor keeps being a I) and all clicks on the DOM are being ignored by Chrome. No message appears, neither obvious nor in the Console (F12). There is no obstructing div or the like in the DOM (F12). Since I couldn't find any hints on the source of my problems, I suspected my plugins and extensions. Unfortunately, neither deactivating all plugins nor all extensions solved the problem. for the problematic pages, it always happens no Dropbox running several GB of free RAM the taskmanager doesn't show any high CPU or memory utilization (the offending tab uses 30 MB and uses 0-1 % CPU) all problematic pages work in other browsers (Chrome, Firefox, IE) the rest of the computer is very responsive the computers use different security suites (Kaspersky and Avira) The effect exists between several (synchronized) Chrome instances on different machines, all running Windows 7. Both the OS and Chrome are updated automatically. Other tabs and the Chrome chrome (tabs, menus, toolbar buttons of the browser itself) still work. I really don't like switching between browsers. Any ideas?

    Read the article

  • Thumbnail generation with imagemagick doesn't render the correct colors

    - by Bastien
    Generating thumbnails of PDFs with imagemagick sometimes renders incorrect colors. We're using an old version of imagemagick (6.5.7-8, that's the version installed on the heroku servers). Here is the command we're currently using: convert -size "725x1200>" -colorspace RGB -flatten -density 300 -quality 100 input.pdf output.jpg I've tried using different colorspaces like sRGB,YIQ,.. but none of them are rendering the color correctly. Using imagemagick-6.7.7-6 locally works so I've tried to bundle the 'convert' command within my application /bin directory, the command works but the result is still wrong, so it seems that the problem comes either from another imagemagick command used by 'convert' or from another library. Here's an example of the outputs: Correct output: http://i.stack.imgur.com/gf9eG.jpg Wrong output: http://i.stack.imgur.com/imUeD.jpg Strangely, with some pages of the same pdf the output is always correct. Any idea which library or command could be the issue, or if there is a proper set of options to pass to imagemagick to always get it right? Thanks in advance for your help.

    Read the article

  • Configure Nginx to render static files and rewrite file extension or proxy_pass

    - by Pardoner
    I've set up Nginx to handle all my static files else proxy_pass to a Node.js server. It's working fine but I'm having difficulty rewriting the url so that it remove the .html file extension. upstream my_upstream { server 127.0.0.1:8000; keepalive 64; } server { listen 80; server_name staging.mysite.com; root /var/www/staging.mysite.org/public; access_log /var/logs/staging.mysite.org.access.log; error_log /var/logs/staging.mysite.org.error.log; location ~ ^/(images/|javascript/|css/|robots.txt|humans.txt|favicon.ico) { rewrite (.*)\.html $1 permanent; try_files $uri.html $uri/ /index.html; access_log off; expires max; } location / { proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_set_header Connection ""; proxy_http_version 1.1; proxy_cache one; proxy_cache_key sfs$request_uri$scheme; proxy_pass http://my_upstream; } }

    Read the article

  • UIView rotation, modal view lanscape and portrait, parent fails to render

    - by Ben
    Hi everyone, I've hit a bit of a roadblock with something that I hope that someone in here can help me out with. I'll describe the 'state of play' first, and then what the issue is, so here goes; I have a series of view controllers that are chained together with a Navigation Controller (this works just fine), All of these view controllers support portrait mode only (by design), In one of the view controllers (the 'end' one actually) the user can click a table cell to pop up a modal view controller (using presentModalViewController(...) of course) This modal view controller supports portrait and landscape modes (and this works), When the user clicks the 'Done' button on this modal view controller we pop and pass control back to the parent view controller, however; If the user is in portrait mode when they click 'Done' then the parent displays itself just fine, If the user is in landscape mode when they click 'Done' then the parent displays a totally white, blank screen (that covers the whole screen). It is as if the controller does not know how to render in landscape and just doesn't bother. I'd like to be able to have this parent view render in portrait no matter what the orientation of the phone is when the user clicks the 'Done' button. Various forum posts suggest using the UIDevice method 'setOrientation' (but this is undocumented and will get our app rejected apparently). Another suggestion was to set the 'statusBarOrientation' to portrait in the 'viewWillAppear' method but that had no effect. So I am a bit stuck! Has any encountered anything like this before? If need be I can provide code, if that will help anyone diagnose the problem for me. Thanks in advance! Cheers, Ben

    Read the article

  • Render view to string followed by redirect results in exception

    - by Chris Charabaruk
    So here's the issue: I'm building e-mails to be sent by my application by rendering full view pages to strings and sending them. This works without any problem so long as I'm not redirecting to another URL on the site afterwards. Whenever I try, I get "System.Web.HttpException: Cannot redirect after HTTP headers have been sent." I believe the problem comes from the fact I'm reusing the context from the controller action where the call for creating the e-mail comes from. More specifically, the HttpResponse from the context. Unfortunately, I can't create a new HttpResponse that makes use of HttpWriter because the constructor of that class is unreachable, and using any other class derived from TextWriter causes response.Flush() to throw an exception, itself. Does anyone have a solution for this? public static string RenderViewToString( ControllerContext controllerContext, string viewPath, string masterPath, ViewDataDictionary viewData, TempDataDictionary tempData) { Stream filter = null; ViewPage viewPage = new ViewPage(); //Right, create our view viewPage.ViewContext = new ViewContext(controllerContext, new WebFormView(viewPath, masterPath), viewData, tempData); //Get the response context, flush it and get the response filter. var response = viewPage.ViewContext.HttpContext.Response; //var response = new HttpResponseWrapper(new HttpResponse // (**TextWriter Goes Here**)); response.Flush(); var oldFilter = response.Filter; try { //Put a new filter into the response filter = new MemoryStream(); response.Filter = filter; //Now render the view into the memorystream and flush the response viewPage.ViewContext.View.Render(viewPage.ViewContext, viewPage.ViewContext.HttpContext.Response.Output); response.Flush(); //Now read the rendered view. filter.Position = 0; var reader = new StreamReader(filter, response.ContentEncoding); return reader.ReadToEnd(); } finally { //Clean up. if (filter != null) filter.Dispose(); //Now replace the response filter response.Filter = oldFilter; } }

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >