Refrehsing Radwindow url when clicking 'Save' to get new form ID

6 posts, 0 answers
  1. Carina
    Carina avatar
    41 posts
    Member since:
    Nov 2012

    Posted 29 Jan 2013 Link to this post

    Hi I have a 'Save' button on my page, and would like to make it refresh its url, so when I have created a new form from a grid, it can get its id, and not be '0'. I have a attached a sample and would like for it to change the circled part to its new ID when clicked. In sql DB it is set up to automacially increase when saved. It already does that, but in order to get the url, I have to manually close the radwindow and open it again from the grid. how can I do that?
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 31 Jan 2013 Link to this post

    Hi Carina,

    If I understand your screenshot and explanations correctly you have:
    - a main page that opens a RadWindow with a grid in it
    - the grid opens another RadWindow inside the first one to edit/update records
    - you want to close the second RadWindow and change the URL of the first

    If this is the case you can attach to the OnClientClose event of the second RadWindow, take the argument you can pass when closing it (see this demo for another example) and set the window.location.href property to the current URL plus the desired querystring you have just obtained from the RadWindow's argument. This will refresh the page with the grid and provide the required querystring to the server.

    If there isn't a first RadWindow, but the grid is directly on the main page the same approach will still work.


    Greetings,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Carina
    Carina avatar
    41 posts
    Member since:
    Nov 2012

    Posted 05 Feb 2013 Link to this post

    Hi Marin,


    Not quite, I want the url pertaining to the opened radwindow to update once that form is created and saved.
    I have a main page with a radgrid, where I click 'Add New' and a radwindow pops up to create a new form (which is then display in main page grid once created and saved). When I click 'Add New' the form ID is '0' but once I save it, it creates a new form ID that pertains only to that form (in SQL Server, it is set up for that ID to increase by one, everytime a form is added). It is adding the new ID to the DB, and when I close it and open the form from a record in the radgrid, the URL contains its proper form ID. I just want that URL to update when I at first 'Save' the form without closing it. so it is the same url as when I open the existing form from the radgrid. on the screen shot, the URL circled, pertains to the radwindow opened no the main page.
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 07 Feb 2013 Link to this post

    Hello Carina,

    If you want to keep the form opened in the RadWindow but change the URL you can simply use the Response.Redirect() method ASP offers to set the new querystring once you have it from your database.

    From what I understand you need to change URLs and redirect pages in your scenario. Once this workswith standard browser windows (window.open()) the same URL handling should work for the RadWindows as well. The iframe they load the content page in is essentially a separate context, much like the browser window.


    Regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Carina
    Carina avatar
    41 posts
    Member since:
    Nov 2012

    Posted 04 Apr 2013 Link to this post

    Hi Marin,

    The third point is incorrect. I want to click the 'Save' button on the radwindow and be able to refresh and the the form ID, so I dont have to keep saving in viewstate all the details. 

    When I first create a form, a radwindow opens. it has the ID=0. When I click save, the form ID is generated in the database and it increases by one, every time a new form is created.All the records in the form are saved in that one record in the database. So I want to be able to get that form ID when I first click on 'Save' and the ID is generated for the form, to be able to keep saving everything onto the database instead of viewstate.

    Right now I am able to close it after I save, and i can open it from the main grid and keep on updating directly to the database.
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 05 Apr 2013 Link to this post

    Hi Carina,

    Redirecting the page to the desired URL should work. How your page handles its URL and data is not related to the RadWindow or our controls, but depends on the custom scenario, requirements and limitations you have. In the end, you can always close the current RadWindow and open a new one with the desired ID after the postback. A similar approach is used in this demo - a script is registered from the code-behind that will close the popup and execute some further logic (which in your case will open the next popup). This article explains script execution from the code-behind in greater detail.
     

    Regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017