ianmcinnes Posted October 13, 2005 Posted October 13, 2005 (edited) Hi guys, Hopefully someone can shed some light on this weird problem: If have an .ascx with standard form controls in it, the section in question is: ... <TR> <TD> <asp:Label id="LblVenueCounty" runat="server">Venue County</asp:Label> </TD> <TD> <asp: DropDownList id="DDVenueCounty" runat="server" OnSelectedIndexChanged="PopulateTown" /> </TD> </TR> ... The form displays fine until I add "OnSelectedIndexChanged=PopulateTown" to 'DDVenueCounty'. As soon as I add this bit of code the entire form is not rendered. So the above example does not work, but this does: ... <TR> <TD> <asp:Label id="LblVenueCounty" runat="server">Venue County</asp:Label> </TD> <TD> <asp: DropDownList id="DDVenueCounty" runat="server" /> </TD> </TR> ... I have no code in the codebehind or anywhere else that could effect this (that I know of) - I have also tried creating the PopulateTown Sub just in case this was effecting it but this makes no difference. :confused: Any help would be apprechiated, this makes no sense to me and I see no reason why the entire form is not displayed! Thanks in advance E Edited October 14, 2005 by ianmcinnes Quote
bri189a Posted October 13, 2005 Posted October 13, 2005 If the sub you wrote called PopulateTown isn't protected (private), then you will recieve an error. Notice in your second example you don't have the OnSelectedIndexChanged event in the attributes...thus no error. Rather than having OnSelectedIndexChanged in the html code you could just wire up the event in the code behind. The only time that I wire up events in the html is if the control is in a container that wouldn't fire child events normally (such as a datagrid). Quote
ianmcinnes Posted October 14, 2005 Author Posted October 14, 2005 Thanks bri189a, I wouldnt mind if it gave me an error message - at least then I could start to work out what is going on! All the examples I have found all show this should work without any problems. I will try moving the OnSelectedIndexChanged to the code behind to see if that solves it. I'd rather keep it in the .ascx so if anyone else can see what's causing this please let me know! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.