C# ASP.net的查询字符串ID

C# ASP.net的查询字符串ID,c#,asp.net,C#,Asp.net,在my.aspx页面中,我有一个href: <a runat="server" href"~/petstore.aspx?pageID=1">Dog Store Page</a> <a runat="server" href"~/petstore.aspx?pageID=2">Cat Store Page</a> 但它似乎无法获取ID:( 我做错了什么?谢谢!我想最好使用两个asp链接按钮,并分别使用单独的单击事件处理程序,如下所示: .asp

在my.aspx页面中,我有一个href:

<a runat="server" href"~/petstore.aspx?pageID=1">Dog Store Page</a>

<a runat="server" href"~/petstore.aspx?pageID=2">Cat Store Page</a>
但它似乎无法获取ID:(


我做错了什么?谢谢!

我想最好使用两个asp链接按钮,并分别使用单独的单击事件处理程序,如下所示:

.aspx

你可以做:

<a href="/petstore.aspx?pageID=1">Dog Store Page</a>
<a href="/petstore.aspx?pageID=2">Cat Store Page</a>

这些链接的呈现HTML是什么?是
Request.QueryString[“pageID”]
返回空字符串或空字符串?呈现何种锚定标记?粘贴到问题中时是否丢失了某些内容?此HTML无效:您需要类似“Yeah,抱歉…”的内容。我需要pageID作为参数,以从数据库加载信息。呈现的URL是什么,即单击时最终显示的URL是什么链接?
<asp:LinkButton ID="CatLinkButton" runat="Server" OnClick="CatLinkButton_Click" Text="Cat Store Page" />
<asp:LinkButton ID="DogLinkButton" runat="Server" OnClick="DogLinkButton_Click" Text="Cat Store Page" />
protected void CatLinkButton_Click(...) { // Do logic }
protected void DogLinkButton_Click(...) { // Do logic }
<a href="/petstore.aspx?pageID=1">Dog Store Page</a>
<a href="/petstore.aspx?pageID=2">Cat Store Page</a>
<a runat="server" id="aDog">Dog Store Page</a>
<a runat="server" id="aCat">Cat Store Page</a>
aDog.Href = "/petstore.aspx?pageID=1";
aCat.Href = "/petstore.aspx?pageID=2";