Post back Issue of Master Page
Hello ,I have a master page having one label control.The Text value of control is set dynamically(ie from db). I am checking is post back also But this code is executing when we click on each page. i need to execute this this only one time. If lot of controls are there, then it not good to use session variable.Please help me.
The code is as follows:
If Not IsPostBack Then
Dim objMasterBAL As New MasterBAL
Dim dT As DataTable
If Session("CompanyId") Is Nothing Then
dT = objMasterBAL.SelectCompanyDetails(IIf(Session("CompanyId") Is Nothing, 1, Session("CompanyId")))
lblCompanyName.Text = dT.Rows(0).Item("CompanyName").ToString
Page.Header.Title = "::" & dT.Rows(0).Item("CompanyName").ToString
End If
end if