Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you determine postback seperately for a usercontrol and the page i

Status
Not open for further replies.

Blubble

Programmer
Apr 3, 2002
3
0
0
US
I have a web form that is structured like this. This is just an example. I use codebehind for all my controls and web forms.

Orders.aspx
-dgrdOrderList (DataGrid)
--EditItemTemplate
---OrderDetail.ascx
----OrderTypeSelect.ascx
-----dropOrderType (DropDownList)


In other words...

Orders.aspx contains a datagrid (dgrdOrderList) that has the
UserControl OrderDetail.ascx in its EditItemTemplate.
OrderDetail.ascx in turn contains another UserControl OrderTypeSelect.ascx. This control has a databound dropDownList.

Normally, I would call the databinding subroutine from the Page_Load sub in OrderTypeSelect.ascx
like so...


Sub Page_Load()

If Not IsPostBack Then

bind_dropOrderType()

End If

End Sub

The problem is that it is alway seeing IsPostBack as true since OrderDetail.ascx is only displayed when the edit button for the DataGrid item has been clicked. My current solution is to call OrderDetail.bind_dropOrderType() from the OnItemCreated sub for the Datagrid when the ItemType is ListItemType.EditItem. This works and the dropDownList gets bound, but it is kind of a hassle and there are some times I don't want to rebind the dropDownList.

Does anyone have any better solutions for how to handle this? Is there a way to check for a postback for just the UserControl OrderDetail.ascx seperate from the page or its parent control?

Thanks,
JC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top