By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

PostBack after AddHandler

P: n/a
Have a dropdownlist created in my LoadMain() which is called from the
Page_load:
************************PAGE LOAD********************8Private Sub
Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Try
'Initialize.
Main.SetBodyURL(Page)
conSess = MySession.Connection(Session)
objPP = MySession.ProdPres(Session, Req.ID(Request))
'Format header and footer.
ProdPresProperties.FormatHeader(Header1, objPP, "Create
Coordinated Set - Size", , , objPP.j_group_type =
ProdPres.GroupType.ENS.ToString)

'Load Page
LoadMain()
With ucCreateButtons
.CreateButton.Text = "Create"
.ResetButton.Text = "Undo"
End With

Catch ex As Exception
FailurePage.SetMessage(Header1, ex)
FailurePage.SetReturnURL(Page, Main.GetPrevURL(Page))
FailurePage.Show(Page)
End Try

End Sub
*******************END PAGE LOAD****************

**********LOAD MAIN ***************************
Private Sub LoadMain()
'Add DropDown List Items for ddlFunction
ddlFunction = New DropDownList
ddlFunction.AutoPostBack = True
ddlFunction.Items.Add(New ListItem("", "0"))
ddlFunction.Items.Add(New ListItem("NONE", "n"))
ddlFunction.Items.Add(New ListItem("ALWAYS", "a"))
ddlFunction.Items.Add(New ListItem("MULTIPLIER", "m"))

'Create AddHandler for ddlFunction
AddHandler ddlFunction.SelectedIndexChanged, AddressOf
ProcessDDLFunction
tr.Cells.Add(CreateDropDownListCell(ddlFunction,
"ddlFunction" & strText, , 85, Css.Style.DefaultText))

***************EN LOAD MAIN*************************

The problem that I am having is that when the SelecteIndex does get changed
the form process the Page_Load again and runs thru my LoadMain(). Then it
processes my AddHandler function. How can I get it to FIRST process the
AddHandler function, then process the Page_Load?
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You can't. This is just how things work. Restructure your code so that it
works the way you need it to. Put code you need to run in a separate method,
and then call it from both page_load when you need it, and from your event
handler if you need it there instead.

"Luis Esteban Valencia Muñoz" <le********@avansoft.com> wrote in message
news:uW**************@TK2MSFTNGP14.phx.gbl...
Have a dropdownlist created in my LoadMain() which is called from the
Page_load:
************************PAGE LOAD********************8Private Sub
Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Try
'Initialize.
Main.SetBodyURL(Page)
conSess = MySession.Connection(Session)
objPP = MySession.ProdPres(Session, Req.ID(Request))
'Format header and footer.
ProdPresProperties.FormatHeader(Header1, objPP, "Create
Coordinated Set - Size", , , objPP.j_group_type =
ProdPres.GroupType.ENS.ToString)

'Load Page
LoadMain()
With ucCreateButtons
.CreateButton.Text = "Create"
.ResetButton.Text = "Undo"
End With

Catch ex As Exception
FailurePage.SetMessage(Header1, ex)
FailurePage.SetReturnURL(Page, Main.GetPrevURL(Page))
FailurePage.Show(Page)
End Try

End Sub
*******************END PAGE LOAD****************

**********LOAD MAIN ***************************
Private Sub LoadMain()
'Add DropDown List Items for ddlFunction
ddlFunction = New DropDownList
ddlFunction.AutoPostBack = True
ddlFunction.Items.Add(New ListItem("", "0"))
ddlFunction.Items.Add(New ListItem("NONE", "n"))
ddlFunction.Items.Add(New ListItem("ALWAYS", "a"))
ddlFunction.Items.Add(New ListItem("MULTIPLIER", "m"))

'Create AddHandler for ddlFunction
AddHandler ddlFunction.SelectedIndexChanged, AddressOf
ProcessDDLFunction
tr.Cells.Add(CreateDropDownListCell(ddlFunction,
"ddlFunction" & strText, , 85, Css.Style.DefaultText))

***************EN LOAD MAIN*************************

The problem that I am having is that when the SelecteIndex does get
changed
the form process the Page_Load again and runs thru my LoadMain(). Then it
processes my AddHandler function. How can I get it to FIRST process the
AddHandler function, then process the Page_Load?

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.