Hello
From the posts thus far I assume you are using windows controls and not web controls. The concept I suggest should work for both. I have created the following object for my web apps which gives me access to the web pages methods and objects. It has given me the ability to bind the WebGrid objects using the web pages .BindControl({control}) method.
Changes/Modifications
1. You should change the namespace to something useful for yourself.
2. BusinessWebPage property should be based on your MM form or web page at it's highest level without being specific e.g. mmBusinessForm versus mySalesForm. Replace dcgBusinessWebPage with your object mmBusinessForm.
Of course, when you use UserControls you will not have the kind of access to the data elements because you are not registering the controls on a MM Bindable form or object. You can still assign the data properties manually or programmatically. Using this object allows you complete access to the properties and methods of the form or web page. And it is simple.
Examples of use (Web version):
this._Waiting = (Waiting) this.BusinessWebPage.GetBizObj("Waiting");
this.BusinessWebPage.BindControl(this.grdWaiting);
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using DCG.Main.Web.UI.Containers;
namespace DCG.Main.Web.UI.Containers
{
public class dcgUserControl : UserControl
{
public dcgUserControl()
{
}
#region Object Properties
[Browsable(false)]
public dcgBusinessWebPage BusinessWebPage
{
get
{
return this._BusinessWebPage;
}
set
{
this._BusinessWebPage = value;
}
}
protected dcgBusinessWebPage _BusinessWebPage = null;
#endregion
#region Object Events
protected override void OnInit(EventArgs e)
{
base.OnInit (e);
this.SetBusinessWebPage();
}
public void SetBusinessWebPage()
{
if (this.BusinessWebPage == null)
{
this.BusinessWebPage = (dcgBusinessWebPage) this.Page;
}
}
#endregion
}
}
>I have read all the posts that are similar to my question here, but the answers posted do not solve my particular issue, so I am posting my question which I will try to explain as best I can.
>
>I have:
>- 1 Form (we'll call FormA)
>- 2 User Controls (We'll call UC1 and UC2)
>
>User Control UC2 is a simple user control that has 2 controls on it, the mmUltraCombo and a standard text box. This user control will be placed on a number of other user controls such as UC1 (see next sentence).
>
>User Control UC1 has a couple of standard text boxes on it, PLUS the user control UC2.
>
>Form 1 has a datagrid, a couple of buttons, as well as User Control UC1.
>
>I have the set the binding source of the datagrid. I have set the binding source of the text boxes on user control UC1.
>
>Via the MM Framework when i click on a row in the datagrid (during runtime), the corresponding detail information shows up in the user control UC1, EXCEPT for the controls on the user control UC2.
>
>Obviously when i placed the user control UC2 on the usercontrol UC1 I am not able to set the binding source of that control like i can with the other controls on UC1.
>
>But I want the same functionality to happen. When i click on a record in teh datagrid on FormA, I want all the controls on UC1 (which include UC2) to dispay the detail information, and that includes the user control UC2 (the combo box on UC2 displays drop down information pertaining to the record selected in the datagrid).
>
>I sincerely hope this made sense. I can send a screen shot if that would help with clarification.
>
>Any information will be greatly appreciated.
>
>Scott