Load Load Control C#

Asked

Viewed 61 times

0

I need to add a conditional Usercontrol. How? if the Pap_id variable is equal to 134, I need to load a Usercontrol displays two inputText for the user to enter a start date and an end date:

  var Pap_id = Convert.ToString(Request.Params["app"]);

  if (Pap_id == "134"){

     //Adicionar UserControl      

  }

This code is in the Pageload() of a page called details.aspx. I would like to know how to do this, because if I drag the usercontrol to the page it appears to the other applications too, but as stated, I want it shown only when the condition is met, if(Pap_id == 134).

  • 1

    You don’t want to use the resource Visible="true" of the components?

  • Opa, I’m beginner in Asp.Net/C#, in case with this feature would leave it as false and pass to true inside if, this is it?

  • Simple as that! Arrow true appear, arrow false occult.. TextBox.Visible = "true"

  • Okay, you could tell me how to get the reference from the Usercontrol that’s on the aspx page in Codebehind?

  • take a look at this example: link

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.