Using CallByName with asp.net

  • Thread starter Thread starter Olivier
  • Start date Start date
O

Olivier

Hi,

I have a web form displaying 5 web usercontrols.
Each usercontrol contains a 'Save' linkButton. Each usercontrol has a panel as container.

One panel is visible at a time.
From my form, I'd like to ba able to execute the Save button's code by using CallByName.e.

Is it possible? How ?

I tried something like CallByName ("TheUserControlClassName","TheSaveButton_Click",CallType.method)
I get the error : Public member 'lnkSave1_Click' on type 'String' not found

Any idea ?

TIA,

olivier
 
Hi, Olivier,

I don't think this function can be of any help to you. You should pass
reference to the instance of your usercontrol as the first parameter. If you
have such a reference you can call the method directly.

If you don't have reference to the usercontrol instance - try using the
FindControl method on the instance of your Page class. Have a look at the
example in the topic:

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebUIControlClassFindControlTopic.asp

Greetings
Martin
Hi,

I have a web form displaying 5 web usercontrols.
Each usercontrol contains a 'Save' linkButton. Each usercontrol has a panel
as container.

One panel is visible at a time.
From my form, I'd like to ba able to execute the Save button's code by using
CallByName.e.

Is it possible? How ?

I tried something like CallByName
("TheUserControlClassName","TheSaveButton_Click",CallType.method)
I get the error : Public member 'lnkSave1_Click' on type 'String' not found

Any idea ?

TIA,

olivier
 
Back
Top