New Way to Pass Querystrings into Dynamically Loaded Usercontrol in ASP.NET

aspnetlogo

Problem:
How to pass values into a usercontrol as querystrings in asp.net.
More References to the problem as as follows:

Solution:

  1. One Can definitely use Session Variables to give the functionality. Set the session variable value in the page and then retrieve the value in the user control.
  2. Another way is to set the Public Property for the userControl.
  3. And one solution is described below which i implemented successfully. It also works for dynamically loaded usercontrol.

The Alternative New Method:

Method is simple:

  1. Add Invisible buttons(or label) to the user control on the page where it will be rendered.
  2. Set the text property of the buttons to the value of the querystring.

    UserControl mycontrol = new UserControl();
    mycontrol = (UserControl)Page.LoadControl(“./UserControls/CustomCallDetailsChart.ascx”);

    Button btnName=new Button();
    btnName.Visible = false;
    btnName.Text=this.Name;
    mycontrol.Controls.AddAt(0, btnName);

    this.Controls.Add(mycontrol);

  3. In the page load event of the usercontrol find the control and typecast the text value to the required datatype.
    protected void Page_Load(object sender, EventArgs e)
    {
    Button btnName = (Button)this.Controls[0];
    this.ChartName = btnName.Text.ToString();
    }

kick it on DotNetKicks.com

Microsoft Surface

surface-logo
Ever wondered even if you could see the contents of your mobile phone on a table as soon as you put the device on the table!!!

Or if you could drag a physical photograph of yours[which is also kept on table] towards the mobile and a copy of it gets stored into the mobile phone.

All this might seem to be a midnight dream of mine to you but all this along with much more has become reality.

Enter Microsoft Surface, an implementation of surface technology wherein the aim is to replace monitors and other output and input devices and bring in the contents of a computer or a device on a table or any other kind of surface and let the user interact with touches.

Microsoft surface

Users interact with surface as shown in image below
Users Interacting with surface

Checkout the cool videos of microsoft surface and learn more about it at Official Homepage of Surface.I hope you will be amazed to look at the possiblities and somewhere in your mind a thought will come that yes our dreams have started becoming true with the help of technology.