CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Apr 2008
    Posts
    3

    Question GridView CheckBox Enable & Checked

    Dear All,

    Greetings


    I am using VS 2010 , VB.net, with SQL Server 2008 & Windows 7

    I have a datagrid name as gvBusinessNature2

    I want to Checked a CheckBox as well as show as disabled where a bound field is not ?NA?

    Can you pls help me, i want to use vb.net code

    Thanks


    PHP Code:
    <asp:GridView ID="gvBusinessNature2" runat="server" AllowPaging="True" 
                                    
    AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                                    
    OnSorting ="gvBusinessNature2_Sorting" 
                                    
    OnPageIndexChanging="gvBusinessNature2_PageIndexChanging"
                                    
    BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4">
                                    <
    Columns>
                                        <
    asp:TemplateField HeaderText="P">
                                            <
    EditItemTemplate>
                                                <
    asp:CheckBox ID="CheckBox1" runat="server" />
                                            </
    EditItemTemplate>
                                            <
    ItemTemplate>
                                                <
    asp:CheckBox ID="CheckBox1" Checked="false" runat="server" />
                                            </
    ItemTemplate>
                                        </
    asp:TemplateField>
                                        <
    asp:TemplateField HeaderText="S">
                                            <
    EditItemTemplate>
                                                <
    asp:CheckBox ID="CheckBox2" runat="server" />
                                            </
    EditItemTemplate>
                                            <
    ItemTemplate>
                                                <
    asp:CheckBox ID="CheckBox2" Checked="false"                                             runat="server" />
                                            </
    ItemTemplate>
                                        </
    asp:TemplateField>
                                        <
    asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" >
                                        <
    ItemStyle Width="50px" />
                                        </
    asp:BoundField>
                                        <
    asp:BoundField DataField="BusinessNature" HeaderText="Business Nature" 
                                            
    SortExpression="BusinessNature" >
                                        <
    ItemStyle Width="300px" />
                                        </
    asp:BoundField>
                                        <
    asp:BoundField DataField="Description" HeaderText="Description" 
                                            
    SortExpression="Description" >
                                        <
    ItemStyle Width="300px" />
                                        </
    asp:BoundField>
                                        <
    asp:BoundField DataField="Action" HeaderText="Action" 
                                            
    SortExpression="Action" />
                                        <
    asp:TemplateField HeaderText="Details View">
                                        <
    ItemTemplate>
                                            <
    div>
                                                <
    a runat='server'
                                                
    onclick='<%# String.Format("ShowDetails(""{0}"");", Eval("Details")) %>'
                                                
    style='text-decoration:underline;'>Details</a>
                                            </
    div>
                                        </
    ItemTemplate
                                        </
    asp:TemplateField>
                                        <
    asp:BoundField Visible="False" DataField="LogID" HeaderText="LogID" />
                                        <
    asp:BoundField DataField="ApprovedBy_A" HeaderText="ApprovalA" 
                                            
    NullDisplayText="NA" />
                                        <
    asp:BoundField DataField="ApprovedBy_B" HeaderText="ApprovalB" 
                                            
    Visible="False" NullDisplayText="NA" />
                                    </
    Columns>
                                    <
    FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                                    <
    HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
                                    <
    PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                                    <
    RowStyle BackColor="White" ForeColor="#003399" />
                                    <
    SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                                    <
    SortedAscendingCellStyle BackColor="#EDF6F6" />
                                    <
    SortedAscendingHeaderStyle BackColor="#0D4AC4" />
                                    <
    SortedDescendingCellStyle BackColor="#D6DFDF" />
                                    <
    SortedDescendingHeaderStyle BackColor="#002876" />
                                </
    asp:GridView
    Last edited by GremlinSA; December 2nd, 2013 at 07:16 AM. Reason: added code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured