Question

I have a link from a web page to another, and the link is supposed to only send a single parameter (PackageName). But here's what happens, the linked web page is being called with 2 params:

.../ETL/JobsLogSpec.aspx?PackageName=Loan_History_Summary_Make_Table&NoDays=10

The NoDays is the unwanted parameter, it is a field in the initial web page, used in a search. Other pages in that app exhibit similar behaviour (too many params). I used a code generator to develop these (CodeCharge), here's the code:

 <tr class="Row">
      <td><mt:MTLabel Source="TaskName" ID="TaskName" runat="server"/></td> 
      <td><mt:MTLink Source="PackageName" ID="PackageName" runat="server" HrefSource="~/JobsLogSpec.aspx" PreserveParameters="Get"><Parameters>
        <mt:UrlParameter Name="PackageName" SourceType="DataSourceColumn" Source="PackageName"/>
      </Parameters></mt:MTLink></td> 

I don't see a problem with this code (but I am a beginner). Can this be something that the server does?

Was it helpful?

Solution

I have never used this product before, but from a quick Google, it seems the issue is that your ItemLink is preserving parameters via the PreserveParameters="Get" attribute.

Either remove the PreserveParameters="Get" attribute completely.

OR

Change your code to PreserveParameters="None".

UPDATE:

Apparently, there is a designer that allows you to visually change these values as well:

enter image description here

OTHER TIPS

To add to the accepted answer, which is entirely right, the reasoning behind the automatic adding of the parameters appears to be that most of the time the parameters will be needed again, and they will remain unless specifically removed. There is usually no problem with having extra querystring parameters if the page doesn't use it - it just keeps turning up (see below for problem).

The 'Preserve Parameters' is usually used to turn on or off all the GET and/or POST values, but individual parameters may be removed by typing them into the 'Remove Parameters' field just above it (semi-colon delimited).

One issue I had was two pages using grids called 'employee' and by default the page selection is a querystring parameter like 'employee_GridPage=2', and so page 2 selected on the first page would also show page 2 if the second page was shown. My solution was to change one grid to 'employees'. I could have also added 'employee_GridPage' to the 'Remove Parameters' on links from the first page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top