Reputation: 61
In my page I have an ajax call for search and filtering and all the filter selection I am appending in URL as a #
param (as appending in form of query string it will refresh the page).
By my problem is that I am not able to access this (#
values) in my code behind (using c#).
I tried to store the #
value in hidden field on window.load
function of javascript, but I will not get this value in page load method of asp.net.
Can anybody suggest how to access this value on page load?
Upvotes: 1
Views: 232
Reputation: 15148
Well, #
is not sent to the server (it's not in the request), you can access it through javascript though, something like:
var hash = window.location.hash;
if (hash !== "") {
hash = hash.substring(1);
alert(hash);
}
If you have to access it on the server, I'm affraid you have to place a query string:
http://yoururl/?test=123
Then you access with: Request.QueryString["test"]
- will get you 123.
Upvotes: 1