Click here to Skip to main content
15,904,288 members

Comments by Member 11759154 (Top 2 by date)

Member 11759154 13-Jun-15 11:23am View    
I did in GridView1_RowDataBound(....) still the same
Member 11759154 12-Jun-15 14:35pm View    
Here is more code
<pre lang="vb">Protected Sub Projects_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) Handles Projects.RowCreated
display only the first,third, fifth.. I need to display all rows first,second,third...
If e.Row.RowState = DataControlRowState.Edit Then
e.Row.Cells(0).Controls(1).Visible = False

End If
//This one is working
If e.Row.RowType = DataControlRowType.DataRow Then
For Each cell As TableCell In e.Row.Cells
e.Row.Cells(2).Enabled = False
e.Row.Cells(4).Enabled = False
e.Row.Cells(5).Enabled = False
e.Row.Cells(6).Enabled = False
e.Row.Cells(7).Enabled = False
Next
End If

End Sub</pre>

<pre lang="xml"><asp:GridView ID="Projects" runat="server" AutoGenerateColumns="False" DataKeyNames="ProjectID" width="75%">
<columns>
<asp:TemplateField HeaderText="ProjectID" Visible="false">
<itemtemplate>
<asp:Label ID="lblProjectID" runat="server" Text='<%# Bind("ProjectID") %>'></asp:Label>
</itemtemplate>
</asp:TemplateField>
<asp:BoundField DataField="Name" HeaderText="Project Number" ReadOnly="true" />
<asp:BoundField DataField="Address" DataFormatString="{0:C}" HeaderText=" Funding" />
<asp:BoundField DataField="Local" DataFormatString="{0:C}" HeaderText="Local" />
<asp:BoundField DataField="Voluntary_Contribution" DataFormatString="{0:C}" HeaderText="Voluntary Contribution" />
<asp:BoundField DataField="Total" DataFormatString="{0:C}" HeaderText="Total"
ReadOnly="True" />
<asp:CommandField ShowEditButton="True" />
</columns>
<HeaderStyle CssClass="GridHeader" />
</asp:GridView></pre>