How can i create one page with the mode code-behind .

Posted by Community Admin on 04-Aug-2018 14:10

How can i create one page with the mode code-behind .

All Replies

Posted by Community Admin on 18-Mar-2013 00:00

Some page dynamic like  
http://localhost/pagedetail/2
http://localhost/pagedetail/3

so i want to create one page(codebehind) like pagedetail to show querystring?

Posted by Community Admin on 18-Mar-2013 00:00

There's a need to notify the route handler that the control on the page is expecting URL parameters to be resolved. To achieve this you need to set the UrlParamtersResolvedKey in the
CurrentHttpContext.Items collection.

You can use the RouteHelper.SetUrlParametersResolved() implementation exactly for these purposes, however please note that this needs to be done in a early stage of the control lifecycle, as we're checking for the key on PreRender_Complete event.


protected override void OnInit(EventArgs e)
       
           base.OnInit(e);
           RouteHelper.SetUrlParametersResolved();
       
       protected void Page_Load(object sender, EventArgs e)
       
           var param = this.GetUrlParameterString(true);
           ParamLiteral.Text = param;
       

This thread is closed