I have a piece of code in a User controls that normally should be put in the Page_Load (initializes other components such DropDowns etc.) but I need this to happen before the Page_Load of the page that hosts this control.
I tried to put this in Page_Init:
protected void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
Methods.PopulateWhatList(cboWhatList0, cboWhatList1, fldWhat, Request["WhatId"], true);
Methods.PopulateWhereList(cboWhereList0, cboWhereList1, fldWhere, Request["WhereId"], true);
Methods.PopulateWhoList(cboWho, true, Request["WhoId"]);
Methods.PopulateWhenList(cboWhen, true, Request["WhenId"]);
Methods.PopulatePriceRangeList(cboPriceRange, true, Request["PriceRangeId"]);
}
}
...but have experienced some problems. So where is the best place to but this type of code?
The problem I'm having (and might be unrelated) is that my:
protected override void Render(HtmlTextWriter writer)
{
Methods.EnableValidationWhereList(cboWhereList1, this.Page);
Methods.EnableValidationWhatList(cboWhatList1, this.Page);
base.Render(writer);
}
Isn't called on certain postbacks? (When pressing a LinkButton?)