Reputation: 5406
I have an .ashx component that is used by a couple of pages, and because of a requirement it needs to have a bool-property in order to act differently for one of the pages that is using the component.
What I would normally do is something like this but that is for .aspx pages, and it doesn't seem to work to do exactly the same for an .ashx page.
What I want is to be able to set a bool property via the .ascx page that'll be reflected in the .ashx page.
This is the current code that is not working:
The .ashx.cs page has this property:
public bool ShowUnpublishedConcepts
{
get; set;
}
That I'm trying to set like this:
<asp:Panel ID="pnlConceptTree" runat="server">
<ExtExt:TreePane ID="treeConcepts"
Loader="ConceptTreeLoader.ashx"
ShowUnpublishedConcepts="True">
</ExtExt:TreePane>
</asp:Panel>
Any ideas?
Upvotes: 0
Views: 595
Reputation: 5406
This solved it for me:
Loader="ConceptTreeLoader.ashx?ShowUnpublished=false"
And in the ashx.cs page I request the parameter:
string ShowUnpublished = context.Request["ShowUnpublished"];
Which will equal to false.
Upvotes: 0
Reputation: 3228
ASHX files are not really pages but server side code so they have no view state. You'll need to put the values in session to have them persist.
Upvotes: 3