I have an.ascx control in my searchresults.aspx page:
<asp:LinkButton id="LinkButton1"
Text="Click Me"
Font-Names="Verdana"
Font-Size="14pt" PostBackUrl="~/searchresults.aspx?type=topics"
runat="server"/>
But when I click on it, it does the postback but the type=topics doesn't appear to be sent. Any suggestions?
Try out HyperLink to navigate to an other page:
<asp:HyperLink NavigateUrl="~/searchresults.aspx?type=topics" />
From MSDN:
HyperLink A control that displays a link to another Web page.
On LinkButton class page:
If you want to link to another Web page when the control is clicked, consider using the HyperLink control.
EDIT: Answer to comments
PostBackUrl
from LinkButton
<asp:LinkButton OnClick="OnTopicsTypesEnabled"... />
searchresults.aspx.cs
) protected void OnTopicsTypesEnabled(object sender, EventArgs args)
{
// handle this particular case
}
I believe your code will perform an POST, whereas you need a GET to transfer your variables through QueryString.
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.