Hello everyone. I'm having a problem with accessing components. I've looked
for a solution in other forums but until now no one have given me any tiny
clue about how could I solve it. I know there is a solution to it, but, I
couldn't find one. I have a webpage in a website with the the following
structure:
Main MasterPage
LoginView
ContentPlaceHolder
Child MasterPage
Table with 2 columns
ContentPlaceHolder1 (in column 1)
ContentPlaceHolder2 (in column 2)
Than I set a regular content page based on the child MasterPage. In the
content for the ContentPlaceHolder1, I put a RadioButtonList or a button. It
shoul trigger an UpdatePanel I put in the content for the ContentPlaceHolder2.
First of all, at runtime, the RadioButtonList couldn't be found by it's
ID. So, I did some research and a lot of peopel, with a more simple structure
seemed to solve their problem with dynamic registering the RadioButtonList as
a trigger. Aparently, the trick was using the RadioButtonList UniqueID as the
ControlID for the trigger. And to put al the code in the Page_Init() method.
My very problem is that I simply can't write a working code to find the
UniqueID. Currently, the (not working) code that I have (in the Iis:
protected void Page_Init()
{
if (IsPostBack)
{
LoginView lv = (LoginView)Master.Master.FindControl("LoginView1")
; //hardcoded in the main Masterpage
ContentPlaceHolder cph_dados = (ContentPlaceHolder)lv.FindControl
("ph_conteudo_principal").FindControl("ph_dados "); //hardcoded in the child
masterpage
ContentPlaceHolder cph_tabela = (ContentPlaceHolder)lv.
FindControl("ph_conteudo_principal").FindControl(" ph_tabela"); //hardcoded
int the child masterpage
AsyncPostBackTrigger trg_cmd_calcula = new AsyncPostBackTrigger()
;
trg_cmd_calcula.ControlID = ((Button)cph_dados.FindControl
("cmd_calcula")).UniqueID.ToString(); // this example is with a button in the
content page, in cph_dados
((UpdatePanel)cph_tabela.FindControl("udp_gridview ")).Triggers.
Add(trg_cmd_calcula);
}
}
Thanks in advance for any help.
Juliano