CheckBox in gridview error 500

melanietokyo

New Member
I have a problem with checkbox in a gridview.When I select all 900 existing checkbox on the grid, it is not possible to do the postback the browser displays a 500 error.Can someone help me?Below is my script:\[code\]<asp:GridView ID="GridViewListaTitularidade" EnableViewState="true" Width="100%" runat="server" AutoGenerateColumns="False" EnableModelValidation="True" CaptionAlign="Left" GridLines="None" OnRowCommand="GridViewListaTitularidade_RowCommand"> <Columns> <asp:TemplateField> <ItemTemplate> <div style="display: none"> <asp:TextBox ID="TextBoxIdTitularidade" runat="server" Visible="false" CssClass="gridHidden" Text='<%# Eval("IdTitularidade") %>' /> </div> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <div style="display: none"> <asp:TextBox ID="TextBoxIdEndereco" Text='<%# Eval("IdEndereco") %>' Visible="false" CssClass="gridHidden" runat="server" /> </div> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Selecionar" ItemStyle-Width="50px"> <ItemTemplate> <asp:CheckBox ID="CheckBoxSeleciona" runat="server" /> </ItemTemplate> <ItemStyle HorizontalAlign="Center" /> <HeaderTemplate> <input id="CheckBoxGridHeader" style="text-align: center" onclick="javascript:SelecionarTodos(this);" type="checkbox" /> </HeaderTemplate> <ItemStyle Width="50px" /> </asp:TemplateField> <asp:BoundField DataField="NomeTitular" HeaderText="Nome Titularidade" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="idTitularidade" HeaderText="Titularidade" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="Endereco" HeaderText="Endereco" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="Bairro" HeaderText="Bairro" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="Cidade" HeaderText="Cidade" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="Estado" HeaderText="Estado" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="Cep" HeaderText="Cep" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:TemplateField> <ItemTemplate> <asp:TextBox ID="TextBoxCpfCnpjTitular" Text='<%# Eval("CpfCnpjTitular") %>' Visible="false" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Alterar Endere?o" ItemStyle-Width="100px"> <ItemTemplate> <asp:ImageButton ID="ImageButtonAlterarEndereco" CssClass='<%# Eval("IdTitularidade") %>' CommandName="AlterarEndereco" ImageUrl="~/CadastroWeb/Imagens/altera.gif" CommandArgument='<%# Eval("IdTitularidade") %>' runat="server" /> <asp:HiddenField runat="server" ID="hfIdTitularidade" Value='http://stackoverflow.com/questions/15479819/<%# Eval("IdTitularidade") %>' /> </ItemTemplate> <ItemStyle HorizontalAlign="Center" Width="100px" /> </asp:TemplateField> </Columns> <SelectedRowStyle HorizontalAlign="Center" VerticalAlign="Middle" /> </asp:GridView>protected void BotaoTransacaoGerarLista_ComandoTransacao(object sender, Mellon.WebControls.BotaoTransacao.ComandarEventArgs e) { var listaMaladiretaDTO = new List<MalaDiretaDTO>(); foreach (GridViewRow row in GridViewListaTitularidade.Rows) { CheckBox checkBox = (CheckBox)row.FindControl("CheckBoxSeleciona"); if (checkBox.Checked) {...\[/code\]help me please...
 
Back
Top