Billy Ma
asked on
ASP.NET C# GridView EditTemplate
I am using Template Field in my GridView, there are ItemTemplate and EditTemplate in it.
However, under certain condition, say, if I have a status field store in my database, and if its value is set to 2, then I want to disable that EditTemplate, so that when user click the Edit button, it will only show the ItemTemplate.
In other words, it should be just work like the following code
<asp:TemplateField HeaderText="YM1 Actual">
<ItemTemplate>
<asp:Label ID="lblProcessActualSelYM1" runat="server" Text='<%# Eval("PROCESS_ACTUAL_SEL_YM1") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddlProcessActualSelYM1" runat="server" Text='<%# Bind("PROCESS_ACTUAL_SEL_YM1") %>' CssClass="selDropDownList"></asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
However, under certain condition, say, if I have a status field store in my database, and if its value is set to 2, then I want to disable that EditTemplate, so that when user click the Edit button, it will only show the ItemTemplate.
In other words, it should be just work like the following code
<asp:TemplateField HeaderText="YM1 Actual">
<ItemTemplate>
<asp:Label ID="lblProcessActualSelYM1" runat="server" Text='<%# Eval("PROCESS_ACTUAL_SEL_YM1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If I cannot solve this, I think the best workaround is to
create a label control
and set the visible value of the drop down list and the label control
create a label control
and set the visible value of the drop down list and the label control
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have already done it, but thanks anyway
ASKER
only one column is not allowed.