Click here to Skip to main content
15,917,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a navigation links(Page1, PAge2, etc) in Master page. when user mouseover on the asp links(Page1, page2) in the navigation bar, a popup menu(ex: Add, Edit, Delete) is shown. when the user selects the menu item(ex: Add) clicked, the following javascript is executed.

window.location.pathname = Page1/Admin/xyz.aspx?action=add"


http://SiteName/page1/Admin/xyz.aspx?action=add

page is opened. and the address bar having the above mentioned path

when I again do the mouseover on the page1 , the popup menu is shown, then if I clicked "Edit" in popup menu

the same page should be opened but the action = edit i.e the following java script is executed.
window.location.pathname = Page1/Admin/xyz.aspx?action=edit"


but the page address bar is showing in the following way

window.location.pathname = Page1/Admin/xyz.aspx?action=add?action=add"
is shown.

in serverside
Request["action"]
value is shown as "add?action=Edit"

why the data passed along with the links is continuing for other address also, even if the page is not the same?

am i doing any mistake here? please help me...
Posted
Updated 20-Jun-10 23:28pm
v2

KishoreT wrote:
why the data passed along with the links is continuing for other address also, even if the page is not the same?


Though you have not posted the code that parses or forms the navigation URL, it is clear from your issue that you are not re-setting the querystring variable/parameter that to append to your base URL.

You keep a URL to navigate and based on the add/edit/delete selection you go ahead and append that value to the base URL. while appending reset the query string parameter. Resetting would remove the old value.
 
Share this answer
 
hi sandeep,

sorry while writing the post i made that mistake.
the actual javascript is

window.location.pathname = Page1/Admin/xyz.aspx?action=edit


but in the address bar it was viewed after the page load is

href="http://SiteName/page1/Admin/xyz.aspx?action=add?action=edit


so I get an error that
Request["action"]
value at server side;
 
Share this answer
 
v2
Comments
Sandeep Mewara 21-Jun-10 8:15am    
1. Don't click answer button when it's actually a comment to my answer. Use 'Add comment' feature.
2. If you post an answer, i will never get any notification and most likely i would miss you posted anything related to my answer.
Sandeep Mewara 21-Jun-10 8:16am    
Answers to your updated thing:
1. Issue remains same. Now you have a link with TWO '?' which is wrong. ? signifies querystring start. Resetting the query string would do for you. It's clearly you are continuing from old value set for querystring that starts from '?'
sorry I didn't get u. what is ment by resetting the query string?

I need to call the same page with different action value.

The error occurs even if I called other pages other than xyz.aspx page.

I am posting actual javascript code
<pre lang="cs">function RedirectRightFrame(Action)
{
switch(Action)
{
//Projects
case &quot;AddProject&quot;:
//alert(window.location.pathname);
window.location.pathname = &quot;Project1/Admin/Projects.aspx?action=add&quot;;
//document.loaction.href(&quot;Projects.aspx?action=add&quot;);
break;
case &quot;EditProject&quot;:
window.location.pathname = &quot;Project1/Admin/Projects.aspx?action=Edit&quot;;
break;
case &quot;DeleteProject&quot;:
window.location.pathname = &quot;Project1/Admin/Projects.aspx?action=Delete&quot;;
break;
//Roles
case &quot;AddRole&quot;:
window.location.pathname = &quot;Project1/Admin/Roles.aspx?action=add&quot;;
break;
case &quot;EditRole&quot;:
window.location.pathname = &quot;Project1/Admin/Roles.aspx?action=Edit&quot;;
break;
case &quot;DeleteRole&quot;:
window.location.pathname = &quot;Project1/Admin/Roles.aspx?action=Delete&quot;;
break;

}
}</pre>


The address at the address bar is as follows
<pre>http://localhost:13846/Project1/Admin/Roles.aspx?action=Edit?action=add </pre>

now tell me what i need to reset the address in the above code?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900