2
Answers

Masterpage - How to display UserControl after page refresh

Kavi suja

Kavi suja

11y
1.6k
1
Hi,
   I'am using Master Page and add several content pages.I've to display an company address in Master Page as Header.For the first time,when I login to the application the address from "Header.ascx" is properly displayed.But,when I do the action in Content Pages,then the address will be disabled.I'm trying to load the "Header.ascx" UserControl  each and everytime the page loads.How I bring the address from "Header.ascx" in to masterpage  each & every time the page loads?Can anyone help me to solve this isssue? (In Masterpage.Master.cs I include the "Header.ascx" as following:
TableRow _row = new TableRow();
            TableCell _cell = new TableCell();
            _row = new TableRow();
            _row.ID = "CompanyHeaderRow";
            tblMenu.Rows.Add(_row);
            _cell = new TableCell();
            _cell.ID = "CompanyHeaderCell";
            // _cell.ColumnSpan = 2;
            ////UserControl uc = this.LoadControl("~/Header.ascx") as UserControl;
            ////_cell.Controls.Add(uc);
            _cell.Controls.Add(LoadControl("Header.ascx"));
            _row.Cells.Add(_cell);
But the address can't be displayed after the page refresh)






Answers (2)