Last post Mar 06, 2011 05:10 AM by uid895650
Mar 06, 2011 02:24 AM|afache|LINK
I am using an objectDataSource for the first time. I am using it for my drop down lists. I have noticed that whenever there is a postback on the page the method that fills the drop down data is always called.
Before implementing the object data source I used to have something like:
If (Page.IsPostBack = False) Then
I wonder if the object Data Source would behave in the same manner as the above code, but I don't see that happening.
Please advise ...... I would like to know if I am on the right track.
Mar 06, 2011 05:10 AM|uid895650|LINK
To be honest, there is no way to control the ObjectDataSource like that (as far as I know - but I might be wrong).
I had the same issue on a project where performance was a major issue and could not afford needless connections to the database. Instead, I did something like:
protected void Page_Load(Object sender, EventArgs e)
protected void BindDropDownList()
DropDownList1.DataSource = ObjectDataSource1;
Hope this helps.
This post might be of use as well.