My problem is, that i want to build my webpage dynamically. I get all the Inforamtions from my database but I can't pass for an example the ID to an other page to build the new Page. What i have so far:
MySqlDataReader r = command.ExecuteReader();
<a id="@r["ID"]" href="test.cshtml?id="+@r["ID"] title="test" method="get"
name="id">test</a>
The URL should look like: ~/test.cshtml?id=1
When I want to request the parameter with:
int message = Convert.ToInt32(Request.QueryString["id"]);
I don't receive anything from my previous page. The problem is that the URL is still ~/test.cshtml
.
I found a solution:
string QueryString = "test.cshtml?id=" + r["ID"].ToString();
<a id="@r["ID"]" href=@QueryString title="Detail" method="get" name="id">Details</a>
The problem was I tried to concatenate 2 string in an a tag, but that is not possible. So i tried to concatenate these 2 before and it works
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.