Using querystring with radtabstrip and radpageview

5 posts, 0 answers
  1. Ratzai
    Ratzai avatar
    14 posts
    Member since:
    Oct 2007

    Posted 09 Nov 2012 Link to this post

    I have problem using querystring parameters with a project where i use a RadTabStrip control with RadPageViews containing different aspx pages.

    The user normally only sees http://MY_SITE_NAME/Default.aspx in the address bar.
    My scenario is that for instance the first tab in the RadTabStrip opens a page, Tasks.aspx inside a Multipage. The Tasks.aspx page has a gridview which opens a detailsview inside a RadWindow. What i want to is is to create an url like http://MY_SITE_NAME/Default.aspx?Tab=Tasks&ProjectID=2&TaskID=1 , reading the querystring parameter in Tasks.aspx i then open the queried task in a RadWindow. 

    The problem is that above my tabcontrol design i have a combobox which can change the current project to another. When the user has followed an url with the previous mentioned parameters, a new project is opened but Default.aspx will open the task with ProjectID=2TaskID=1even though the project has changed to a new project and the querystring shouldn't be used anymore. 

    I know I can save the querystring parameters in Session and redirect the user in Default.aspx, but I would like to avoid using the Session variable. 

    I have also tried to save the TaskID in the Context item, and do a Server.Transfer to the same page, but this gives me a stackoverflow exception.

    How do I address this problem in the best way? Any suggestions would be appreciated
  2. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 14 Nov 2012 Link to this post

    Hello Ratzai,

    Could you please explain in more details what the exact scenario that you want to implement is?

    As far as I understand - you want to add parameters to the querystring when a PageView is displayed.
    Then you want to remove these parameters from the querystring when a new item(different project) from RadComboBox control is selected.
    Have you managed to add the parameters TaskID and ProjectID to the querystring and how?
    Can you provide us some working code that illustrates your implementation?

    In addition, do you want to change the TaskID and ProjectID in the querystring or to remove these parameters after the selection of the RadComboBox is changed?

    Thank you in advance for your collaboration.
    Regards,
    Nencho
    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. Ratzai
    Ratzai avatar
    14 posts
    Member since:
    Oct 2007

    Posted 14 Nov 2012 Link to this post

    Hello Nencho,

    I will try to give a more detailed explanation of my scenario :)

    This is my home page http://imgur.com/beE3v

    The page consists of a RadTabStrip and a RadMultiPage

    The view in the screenshot shows the Tasks.aspx page loaded inside the MultiPage.
    Double clicking a row in the Task RadGrid opens a detailsview of the Task inside a RadWindow.

    What i want to do is: Create a permanent link to a specific Task in the RadGrid.
    So when the user opens this URL: 
    http://localhost:53436/Modules/Home/Default.aspx?Tab=RTFrontpage&ProjectID=68&ProjectTaskID=100
    The page automatically opens a RadWindow containing the Task with the ID=100
    This is the implementation of the code in Default.aspx and it works:
    if (Request.QueryString.Count != 0 )
              {
                  CmbProject.SelectedIndex = CmbProject.FindItemIndexByValue(Request.QueryString["ProjectID"].ToString());
                  DispatchDetailsView();
              }

    DispatchDetailsView()
    private void DispatchDetailsView()
          {
              switch (Request.QueryString["Tab"] )
              {
                  case "RTFrontpage":
                                  int projectTaskID = Convert.ToInt32(Request.QueryString["ProjectTaskID"]);
                                  RadMultiPage1.FindPageViewByID("PVHome").ContentUrl = "Overview.aspx";
                                  Context.Items["ProjectTaskID"] = projectTaskID;
                                  RTSMain.SelectedIndex = RTSMain.FindTabByValue("RTFrontpage").Index;
                                  break;
                  default:
              break;
              }

    The Tasks.aspx page (shown in the screenshot) does this in Page_Load
    if (!IsPostBack)
              {
                  taskBC = BCFactory.TaskBC;
                  if (Request.QueryString["ProjectTaskID"] != null)
                  {
                      int projectTaskID = Convert.ToInt32(Request.QueryString["ProjectTaskID"]);
                      RadWindow editForm = new RadWindow();
                      editForm.NavigateUrl = "../Home/Detailsview/ProjectTaskDetailsView.aspx?ProjectTaskID=" + projectTaskID;
                      editForm.VisibleStatusbar = false;
                      editForm.VisibleOnPageLoad = true;
                      editForm.Width= 350;
                      editForm.Height = 490;
                      RadWindowManager1.Windows.Add(editForm);
                  }


    The problem is that when the user is done with the task and want to do other stuff, OR if the user changes to another project with the ComboBox in the top of the page, the QueryString still remains in the url.
    So when a user changes to another project and goes to the Task tab. The ProjectTaskID provided in the QueryString will open even though it is a different project.

    I hope this explained the scenario a bit more. I don't know if my approach to this is correct so I am open for any suggestions to solve the problem. 

    I just want the ability to create a permalink to a detailsview and get rid of the querystring whenever the detailsview has been shown.



  5. Ratzai
    Ratzai avatar
    14 posts
    Member since:
    Oct 2007

    Posted 10 Dec 2012 Link to this post

    Still haven't resolved my problem :(  Do you need some more info about it?
  6. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 13 Dec 2012 Link to this post

    Hello Ratzai,

    As I can see, in the Page_Load event you build the desired query string. I can suggest you to use a flag or a session variable, in order to determine within which project the user is currently in and build the query string only when needed. In addition, you could clear the query string in the following manner :

    Request.QueryString.Clear();

    Please refer to this article, where this topic is discussed in details.


    All the best,
    Nencho
    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