Sunday, July 15, 2012

Passing values to UserControl in ASP.Net using C#

In this blog I showed interaction between 2 user controls Here later passing value from user control to main page at Here and now i will show how to send values from main page to user control.

Passing value to user control is very easy when compared to the above two posts mentioned.

Out Put :

Now just create a user control in your website and add a method in the user control as shown below.

    public void value2Usercontrol(string val)
        txtReceived.Text = val;

In the main page  Button click event write the following code

    protected void btnSend_Click(object sender, EventArgs e)

No comments:

Post a Comment