DataGrid generated ID and Name for elements differ across servers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PhilMond
    New Member
    • Mar 2008
    • 2

    DataGrid generated ID and Name for elements differ across servers

    An ASP.NET page was created with VS 2003 to run on NET Framework 1.1.

    The code for the datagrid starts with:
    <asp:datagrid id="DGUnpaidInv oices" runat="server" AutoGenerateCol umns="False">
    and includes:
    <ItemTemplate>< asp:CheckBox id="ChkFullyPai d" onclick="FullyP aid(this);" runat="server" Width="112px"></asp:CheckBox></ItemTemplate>

    On one server this page produces HTML:

    <span style="width:11 2px;"><input id="DGUnpaidInv oices__ctl2_Chk FullyPaid" type="checkbox" name="DGUnpaidI nvoices:_ctl2:C hkFullyPaid" onclick="FullyP aid(this);" /></span>

    On another server the same page produces:

    <span style="display: inline-block;width:112 px;"><input id="DGUnpaidInv oices_ctl02_Chk FullyPaid" type="checkbox" name="DGUnpaidI nvoices$ctl02$C hkFullyPaid" onclick="FullyP aid(this);" /></span>

    Note "02" and $ in the second case.
    A client side code expecting the name in "DGUnpaidInvoic es:_ctl2:ChkFul lyPaid" format fails on the second server.

    What is the cause of this difference???
    Thanks,
    Phil
  • PhilMond
    New Member
    • Mar 2008
    • 2

    #2
    Got an answer
    .NET Framework 2.0 assigns ID and NAme differently from 1.1

    Comment

    Working...