Question : .NET website. Changing name of databound dropdownlist... blank page results?

Hi,

I am receiving an error I can't figure out. I have a dropdownlist which is databound to an accessdatasource. The access data source is correct and is returning data. The dropdownlist has valid Datatextfield and DatavalueField values selected. The name of the dropdownlist is ddlACEReference. All i want to do is change the name to ddlCARAReference instead...

doesn't work? All i get is a blank page after doing it... i.e. nothing is rendered. So, there must be an error somewhere... but where? If i rename the dropdown back to the original name... it is fine again?

Answer : .NET website. Changing name of databound dropdownlist... blank page results?

Thanks for the code. I checked it out. I made an access database matching your base table structure, stored it in the app_code folder. I used both of your variations on the markup.

I could not get either to work until I made a small modification to your alias. Your DataTextField/DataValueField are set to use "CARA_Ref", but your SELECT statement was using the alias [CARA Ref]. I just modified the SELECT statement to use the alias [CARA_Ref]

Once I did this both of them work fine. I'm not saying this is your issue, just reporting my experience.

I will note that I don't use Access as my datasource very often anymore, but when I do I always notice it is incredibly picky/quirky about specific syntax issues, etc. I am kindof surprised it was working for you when you had this error. I was getting a huge error.

So in principle (as you already know) changing the ID of the <asp:dropdownlist> should have absolutely no effect on the binding to your datasource.

You are likely dealing with one of the following:
1) Some quirk of access, and a small correction will fix it (ie what I noted before)
2) There is a reference to the datasource or the dropdownlist in the code behind that is altering the relationship and changing the ID is breaking things. Look for any reference to the ID of the dropdown or the datasource in code behind and if they exist update the ID there as well.
   NOTE: This doesn't make a ton of sense because it would likely cause an error, but it may be in a try/catch block or something that is derring the error from casual observation.
3) Something pecualiar is happening in the cacheing, remove this reference until you resolve the rest of the issue.

One thing I note as a discussion piece is the difference in the ID's you've chosen. ddlACEReference vs ddlCARAReference. I note your db has an extension of .mdb. The ID ddlACEReference makes me think you are using MS Access 2007+ because its engine is "Ace", but the ext for that is .accdb. Maybe it's all just coincidence? How did you create the db? What version of Access are you using. For my test I made a db in Access 2007 and then converted it to 2003 so it used an .mdb extension.

Sorry if I can't be more help. You are right, it is something else, but what I dunno see if you can find any more information to share. Fix the alias, this is quirky to me and makes me think maybe we are using different db setups (and this could be a clue) because it shouldn't work in either scenario for you with that syntax issue there.
Random Solutions  
 
programming4us programming4us