Search code examples
c#sharepoint-2007web-partsmoss

pass textbox value of one web part to another webpart in MOSS 2007


I want to pass a value of a text box, which is in an user control (.ascx) page to another web part. The .ascx page in another webpart.

The code in the web part looks like this.

    protected override void CreateChildControls()
    {            
            base.CreateChildControls();          
            _childControl = Page.LoadControl("~/_CONTROLTEMPLATES/MyFolder/MyPage.ascx");
            this.Controls.AddAt(0, _childControl);

    }

I have text box inside MyPage.ascx and I want to use that value in another webpart.

I tried creating Interface and communication channel, but I am not able to figure out the logic to access the textbox.

Any help would be appreciated.

TIA,

Idds

p.s: I am new to sharepoint


Solution

  • Some of the solution or the way to pass variable that I tried,

    The value of textbox or any variable for that matter, should be passed through either QueryString or Static variables or Session Variables.

    Static variable should be used only when you feel the data is persisted through out your application closes for the reassons kow.

    To use Session variable, Session should be activated from the Sharepoint admin.

    Query string is the one of the feasible solution when the security is not much concern.