adding a parameter to href link
50,263
Solution 1
You can do it this way,
function func(){
var SchoolId = 0;
window.location.href = "school_info.aspx?edit_school=true&school=" + SchoolId;
}
<!DOCTYPE html>
<html>
<body>
<a onclick="func();">Click Here</a>
</body>
</html>
That is, calling the href tag from the javascript after manipulating the href link.
Solution 2
You Can Use This
<a href="/order/[email protected]">@Model.OrderCode</a>
</p>
So Your parameter should be string , you can convert it to int or something else.
Related videos on Youtube
Author by
Iria
.NET software developer with some experience in Databases (SQL, SQLite...). Currently dealing with Xamarin and Android, mobile applications
Updated on July 09, 2022Comments
-
Iria almost 2 years
I need to send the user to another webpage but setting up parameters, I am using the QueryString in that page for that. This is my code:
<a href= "school_info.aspx?edit_school=true&school=" + SchoolId>School Profile</a>
SchoolId is a parameter that I need to add, I have tried
.ToString()
and it does not work, any help?The parameter is defined in the aspx.cs code
-
ahmednawazbutt over 6 yearscould you show some code what you have done?
-
ahmednawazbutt over 6 yearsalways post related code so that one can have clear understanding of your requirement
-
-
Iria over 6 yearsthanks, i was trying to find a way of directly doing it in HTML but I guess that it's not possible
-
Gowtham Shiva over 6 yearsyes, i guess there is no other way to do it in html. Please mark answer to make the question resolved.