Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a gridview with checkbox on each row
on search i change the datasource select command then bind the gridview according to the new select statement

after that the checkbox value return false even if it is checked
and the delete row returning error for enableEventValidation i set it to false to check if the problem solved the error gone but no row deleting occurred

any suggestions?

code:
ASP.NET
<asp:GridView ID="GV" runat="server" CssClass="gridviewGV" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="DomainsDS"
        Font-Size="12px" PageSize="1000" Width="100%" EmptyDataText="No Records">
        <Columns>
                <ItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="Img/Del.png" Text="Delete" />
                       <asp:checkbox" ID="CheckBox" runat="server" />
                </ItemTemplate>
                <HeaderStyle Width="50px" />
            </asp:TemplateField>
        </Columns>
    
    </asp:GridView>



On btn click after the search change the datasouce select command and checked some of the checked boxes

VB
For b As Integer = 0 To GV.Rows.Count - 1
               Dim checkcx As checkbox=ctype(GV.Rows(b).findcontrol("CheckBox"),checkbox)
               If checkcx.checked Then
'Do Some code here
               End If

           Next


but this check box is always false even if it is checked

this code is working 100% before the post back

but i need the post back to filter the data in gridview
Posted
Updated 1-Sep-14 2:14am
v2
Comments
Kornfeld Eliyahu Peter 1-Sep-14 7:50am    
It sounds me like a postback problem, but hard to tell anything more specific without a bit of your code...
ChintanShukla 1-Sep-14 7:53am    
Code Please.
[no name] 3-Sep-14 7:31am    
post your code

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900