J
james.e.coleman
Hello,
I have created a custom dropdownlist that is used multiple times within
a single page. When trying to set the values of the controls with the
page in which they are being used, they all are set to the value of the
last control. I found this link:
http://www.codecomments.com/archive315-2005-1-366113.html which I think
explains the situation but I'm not sure how to implement the solution
in my case since I am not using a .ascx control, but a programmatically
created control.
++++++++++++++++++
Following is an abbreviated example of what I'm trying to do:
In the .ascx page
<%@register tagprefix=custom %>
<custom:mydropdownlist></custom:mydropdownlist>
In the .ascx.vb page
Private Sub LoadInfoFromSession()
mydropdownlist1.selectedvalue = 1
mydropdownlist2.selectedvalue = 2
mydropdownlist3.selectedvalue = 3
End Sub
Private Sub Page_PreRender()
LoadInfoFromSession()
'Note it doesn't work in Page_Load at all
End Sub
..vb File that contains dropdownlist
Public Class MyDropDownList
Inherits dropdownlist
End Class
+++++++++++++++++++++++++++
When the control containing the dropdownlists is loaded, they are all
set to 3. I have tried using the INamingContainer, Page.Databinding,
and a bunch of other optons. None have worked.
If I use a system dropdownlist, I have no problems setting the
individual values.
Any help is greatly appreciated.
Thanks,
James
I have created a custom dropdownlist that is used multiple times within
a single page. When trying to set the values of the controls with the
page in which they are being used, they all are set to the value of the
last control. I found this link:
http://www.codecomments.com/archive315-2005-1-366113.html which I think
explains the situation but I'm not sure how to implement the solution
in my case since I am not using a .ascx control, but a programmatically
created control.
++++++++++++++++++
Following is an abbreviated example of what I'm trying to do:
In the .ascx page
<%@register tagprefix=custom %>
<custom:mydropdownlist></custom:mydropdownlist>
In the .ascx.vb page
Private Sub LoadInfoFromSession()
mydropdownlist1.selectedvalue = 1
mydropdownlist2.selectedvalue = 2
mydropdownlist3.selectedvalue = 3
End Sub
Private Sub Page_PreRender()
LoadInfoFromSession()
'Note it doesn't work in Page_Load at all
End Sub
..vb File that contains dropdownlist
Public Class MyDropDownList
Inherits dropdownlist
End Class
+++++++++++++++++++++++++++
When the control containing the dropdownlists is loaded, they are all
set to 3. I have tried using the INamingContainer, Page.Databinding,
and a bunch of other optons. None have worked.
If I use a system dropdownlist, I have no problems setting the
individual values.
Any help is greatly appreciated.
Thanks,
James