Note that there are some explanatory texts on larger screens.

plurals
  1. PODisabling ASP .NET CheckBoxList
    primarykey
    data
    text
    <p>I'm building a dynamic ASP table, with CheckBoxLists in each cell. Based on internal conditions, some of these lists should be disabled. It works in Chrome and FF, but not in IE9. I've stepped through the code that is doing the disabling, and the Enabled property is correctly set to false, but it doesn't render correctly to IE. Anyone have an idea why?</p> <pre><code>Table optionTBL = new Table(); optionTBL.ID = "optionTBL"; TableRow headerRow = new TableRow(); TableRow listRow = new TableRow(); listRow.VerticalAlign = VerticalAlign.Top; foreach( string[] iss in issues ) { // make a header TableHeaderCell cell = new TableHeaderCell(); string headerTXT = "BLAH"; cell.Text = headerTXT; cell.Width = Unit.Percentage( 33 ); cell.Height = Unit.Pixel( 1 ); cell.HorizontalAlign = HorizontalAlign.Center; headerRow.Cells.Add( cell ); // put all the options in the radio list CheckBoxList checkLST = new CheckBoxList(); checkLST.ID = "CKBLST" + iss[ 0 ]; while( condition ) { // build the issue radios here checkLST.Items.Add( new ListItem( "Text", "Value" ) ); } foreach( ListItem li in checkLST.Items ) li.Attributes.Add( "theValue", li.Value ); // put the list in a cell in the row in the table TableCell cell2 = new TableCell(); // some formatting checkLST.BorderColor = System.Drawing.Color.Black; checkLST.BorderStyle = BorderStyle.Solid; checkLST.BorderWidth = 1; checkLST.Width = Unit.Percentage( 100 ); // here we disable the check list if needed if( needDisabled ) { // disable the list, and check one checkLST.Enabled = false; checkLST.Items[ alreadySelected ].Selected = true; } // add the list in the cell cell2.Controls.Add( checkLST ); cell2.Width = Unit.Percentage( 33 ); // put the cell in the row listRow.Cells.Add( cell2 ); } // put the table in the literal optionTBL.Height = Unit.Percentage( 100 ); optionTBL.CellPadding = 5; optionTBL.CssClass = "vote_table"; // here we have all the tables we need, stick em all in the literal on the page contentPanel.Controls.Add( optionTBL ); </code></pre> <p>content panel is in the ASPX as follows, and is the only control in the markup</p> <pre><code>&lt;asp:Panel runat="server" ID="contentPanel" Height="450px" &gt;&lt;/asp:Panel&gt; </code></pre> <p>output from IE9</p> <pre><code>&lt;div style="height: 450px;" id="contentPanel"&gt; &lt;table style="height: 100%;" id="optionTBL" class="vote_table" border="0" cellPadding="5"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;th style="width: 33%; height: 1px;" align="center"&gt;ballot 1&lt;br&gt;Select 1&lt;br&gt;&lt;/th&gt;&lt;th style="width: 33%; height: 1px;" align="center"&gt;ballot 2&lt;br&gt;Select 1&lt;br&gt;&lt;/th&gt; &lt;/tr&gt;&lt;tr vAlign="top"&gt; &lt;td style="width: 33%;"&gt;&lt;table style="border: 1px solid black; width: 100%;" id="CKBLST8"" border="0"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;span theValue="29"&gt;&lt;input id="CKBLST8_0" name="CKBLST8$0" type="checkbox"&gt;&lt;label for="CKBLST8_0"&gt;Name A&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span theValue="30"&gt;&lt;input id="CKBLST8_1" name="CKBLST8$1" type="checkbox"&gt;&lt;label for="CKBLST8_1"&gt;Name B&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span theValue="0" WWW="1"&gt;&lt;input id="CKBLST8_2" name="CKBLST8$2" type="checkbox"&gt;&lt;label for="CKBLST8_2"&gt;&lt;input id="writeIn82" value="Write In Candidate" type="text"&gt;&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td style="width: 33%;"&gt;&lt;table style="border: 1px solid black; width: 100%;" id="CKBLST9"" border="0"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;span theValue="31"&gt;&lt;input id="CKBLST9_0" name="CKBLST9$0" type="checkbox"&gt;&lt;label for="CKBLST9_0"&gt;Name 1&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span theValue="33"&gt;&lt;input id="CKBLST9_1" name="CKBLST9$1" type="checkbox"&gt;&lt;label for="CKBLST9_1"&gt;Name 2&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span theValue="0" WWW="1"&gt;&lt;input id="CKBLST9_2" name="CKBLST9$2" type="checkbox"&gt; &lt;label for="CKBLST9_2"&gt;&lt;input id="writeIn92" value="Write In Candidate" type="text"&gt; &lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt; </code></pre> <p>output from chrome</p> <pre><code>&lt;div id="contentPanel" style="height:450px;"&gt; &lt;table id="optionTBL" class="vote_table" cellpadding="5" border="0" style="height:100%;"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;th align="center" style="height:1px;width:33%;"&gt;ballot 1&lt;br&gt;Select 1&lt;br&gt;&lt;/th&gt;&lt;th align="center" style="height:1px;width:33%;"&gt;ballot 2&lt;br&gt;Select 1&lt;br&gt;&lt;/th&gt; &lt;/tr&gt;&lt;tr valign="top"&gt; &lt;td style="width:33%;"&gt;&lt;table id="CKBLST8" disabled="disabled" border="0" style="border-color:Black;border-width:1px;border-style:Solid;width:100%;"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;span disabled="disabled" thevalue="29"&gt;&lt;input id="CKBLST8_0" type="checkbox" name="CKBLST8$0" checked="checked" disabled="disabled"&gt;&lt;label for="CKBLST8_0"&gt;Name A&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span disabled="disabled" thevalue="30"&gt;&lt;input id="CKBLST8_1" type="checkbox" name="CKBLST8$1" disabled="disabled"&gt;&lt;label for="CKBLST8_1"&gt;Name B&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span disabled="disabled" thevalue="0"&gt;&lt;input id="CKBLST8_2" type="checkbox" name="CKBLST8$2" disabled="disabled"&gt;&lt;label for="CKBLST8_2"&gt;&lt;input type="text" id="writeIn82" value="" disabled="disabled"&gt;&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt;&lt;td style="width:33%;"&gt;&lt;table id="CKBLST9" disabled="disabled" border="0" style="border-color:Black;border-width:1px;border-style:Solid;width:100%;"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;span disabled="disabled" thevalue="31"&gt;&lt;input id="CKBLST9_0" type="checkbox" name="CKBLST9$0" checked="checked" disabled="disabled"&gt;&lt;label for="CKBLST9_0"&gt;Name 1&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span disabled="disabled" thevalue="33"&gt;&lt;input id="CKBLST9_1" type="checkbox" name="CKBLST9$1" disabled="disabled"&gt;&lt;label for="CKBLST9_1"&gt;Name 2&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td&gt;&lt;span disabled="disabled" thevalue="0"&gt;&lt;input id="CKBLST9_2" type="checkbox" name="CKBLST9$2" disabled="disabled"&gt;&lt;label for="CKBLST9_2"&gt;&lt;input type="text" id="writeIn92" value="" disabled="disabled"&gt;&lt;/label&gt;&lt;/span&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt; &lt;/div&gt; </code></pre> <p>Note this only the portion of the ASP Panel, not the whole webpage</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload