Trouble with autogenerated id on differently configuerd machines

  • Thread starter Thread starter tonicvodka
  • Start date Start date
T

tonicvodka

Hi everyone!

On my development machine I'm running Windows XP Professional and
ASP.NET 2.0.50727.
On the production server we're running Windows Server 2003 and ASP.NET
2.0.50727.

When I deploy the same project on both, the asp:datalist autogenerates
it's objects id's differently;

DEV-server: <table id="lstEstates__ctl0_tblEstate"

PROD-server: <table id="lstEstates_ctl00_tblEstate"

Has anyone experienced this? Is there a workaround? Since I'm building
scripts with the autogenerated ID's from lstEstates_ItemDataBound-
function it's causing a problem.

Thanks for any help!

Niclas
 
You can use a control's ClientID property in generating your script code (it
needs to be concatenated into the script string at execution time) in order
to ensure that you always are using the correct id.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com












- Visa citerad text -

Thanks Peter,

Excellent, it works! I was building my own clientids, this seems like
a better approach :)
 
Back
Top