Reputation: 25701
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?
Upvotes: 1
Views: 10778
Reputation: 62504
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
}
Upvotes: 3
Reputation: 46047
I believe your code will perform an POST, whereas you need a GET to transfer your variables through QueryString.
Upvotes: 1