Conditional Row in Grid

D

DC

I have this datagrid:

<asp:DataGrid id="dgList" runat="server" Width="100%" CssClass="BodyText"
AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" PageSize="20" BorderColor="#CC9966"
BorderStyle="None" BorderWidth="1px"
BackColor="White" CellPadding="4" HorizontalAlign="Right">
<SelectedItemStyle Font-Bold="True" ForeColor="#663399"
BackColor="#FFCC66"></SelectedItemStyle>
<ItemStyle ForeColor="#330099" BackColor="White"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="#FFFFCC" CssClass="headerList"
BackColor="#990000"></HeaderStyle>
<FooterStyle HorizontalAlign="Right" ForeColor="#330099"
CssClass="BodyText" BackColor="#FFFFCC"></FooterStyle>
<Columns>
<asp:BoundColumn DataField="doccatalogid"
SortExpression="tblIntra_DocCatalog.doccatalogid"
HeaderText="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="doccatalogname"
SortExpression="tblIntra_DocCatalog.doccatalogname" HeaderText="Catalog
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="parentname" SortExpression="parentname"
HeaderText="Parent"></asp:BoundColumn>
<asp:EditCommandColumn EditText="Edit" HeaderText="Action"
ItemStyle-Width="40px"></asp:EditCommandColumn>
</Columns>
<PagerStyle HorizontalAlign="Right" PageButtonCount="5"
ForeColor="#330099" BackColor="#FFFFCC"
CssClass="bodytext" Mode="NumericPages"></PagerStyle>
</asp:DataGrid>


And the SQL statement for it is:

SELECT doccatalogid, doccatalogname, parentName, isHardcoded
FROM tblCatalog


Now, how do I have the Edit column visible ONLY if isHardcoded field = 0 ?

Thanks in advance.

- DC
 
K

Konrad Rotuski

try using ItemCreated Event, and if isHardcoded for that row is 0, remove
all the content from Edit cell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top