How to pass data from one usercontrol to another usercontrol

ondimand ondimand 21 Reputation points
2021-05-15T18:39:06.797+00:00

i have two usercontrols like below in service.aspx file

<%@ Register Src="BPRS.ascx" TagName="BPRS" TagPrefix="ucBPRS" %>
<%@ Register Src="MMSE.ascx" TagName="MMSE" TagPrefix="ucMMSE" %>

as per current implementation

1.enter clientId in BPRS will auto populate other details in BPRS.

2.handling everything in same user control

but I need to do

1.enter clientID in BPRS should auto populate details in BPRS(get by ClientID related details) and MMSE(get by ClientID related details).

2.simplity when i enter clientId in BPRS ,it should hit MMSE usercontrol as well .

Is there any way to do this ? I was unable to find in my search .

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,507 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,008 questions
{count} votes

Accepted answer
  1. Yijing Sun-MSFT 7,086 Reputation points
    2021-05-17T08:53:03.153+00:00

    Hi @ondimand ondimand ,
    I wouldn't recommend passing data from one UserControl to another UserControl. UserControl should be independent from others...If you code direct dependencies between UserControl then why to write them as different controls, write them as a single control.
    I suggest you could use session/cookie.It's easy.
    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.