Welcome Guest Search | Active Topics | Sign In | Register

Grid and push button Options
Mike_C
Posted: Wednesday, April 25, 2012 11:31:34 AM
Rank: Newbie
Groups: Member

Joined: 4/4/2012
Posts: 8
I have a grid push button column - i wish to make it invisible unless another field has a specific value. I tried adding Visible='<%# Eval("Data Item") <> "Lifestyle" %>' attribute to the button column but it did not like it. here is my grid


<eo:Grid ID="grdExcl" runat="server" BorderColor="#C7D1DF" BorderWidth="1px" ClientSideOnItemCommand="grdOnExclude"
ColumnHeaderAscImage="00050303" ColumnHeaderDescImage="00050304" ColumnHeaderDividerImage="00050302"
FixedColumnCount="1" Font-Bold="False" Font-Italic="False" Font-Names="Verdana"
Font-Overline="False" Font-Size="8pt" Font-Strikeout="False" Font-Underline="False"
GridLineColor="199, 209, 223" Height="429px" ItemHeight="21" KeyField="ID" Width="100%"
EnableKeyboardNavigation="True" AllowNewItem="True" FullRowMode="False"> <%--here--%>
<ItemStyles>
<eo:GridItemStyleSet>
<ItemStyle CssText="background-color: white" />
<ItemHoverStyle CssText="background-image:url('00050202');background-repeat:repeat-x;" />
<SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
<CellStyle CssText="padding-left:4px;padding-top:2px; color:#336699;white-space:nowrap;" />
<ItemHoverStyle CssText="background-image:url('00050202');background-repeat:repeat-x;" />
<SelectedStyle CssText="background-image: url(00050207); background-repeat: repeat-x" />
<CellStyle CssText="padding-left:4px;padding-top:2px; color:#336699;white-space:nowrap;" />
</eo:GridItemStyleSet>
</ItemStyles>
<ColumnHeaderStyle CssText="background-image:url('00050301');padding-left:4px;padding-top:2px;font-weight: bold;color:white;" />
<ColumnHeaderStyle CssText="background-image:url('00050301');padding-left:4px;padding-top:2px;font-weight: bold;color:white;" />
<Columns>
<eo:RowNumberColumn Width="0">
</eo:RowNumberColumn>
<eo:ButtonColumn AllowResize="False" ButtonText="Delete"
ButtonType="PushButton" ClientSideBeginEdit="" CommandName="REMOVE_ROW"
DataField="ID" HeaderText="Action" StyleField="" Width="72">
<ButtonStyle CssText="font-family:tahoma;font-size:8pt;" />
<CellStyle CssText="padding-bottom:0px;padding-left:2px;padding-right:0px;padding-top:0px;" />
<ButtonStyle CssText="font-family:tahoma;font-size:8pt;" />
<CellStyle CssText="padding-bottom:0px;padding-left:2px;padding-right:0px;padding-top:0px;" />
</eo:ButtonColumn>
<eo:StaticColumn DataField="DataItem" HeaderText="Data Item" Width="265">
</eo:StaticColumn>
<eo:CustomColumn AllowSort="True" ClientSideBeginEdit="on_begin_edit_assign"
ClientSideEndEdit="on_end_edit_assign"
ClientSideGetText="on_column_gettext_assign" DataField="GLAcct"
HeaderText="GL Account" Width="200">
<%--ClientSideEndEdit="on_end_edit_assign" ClientSideBeginEdit="on_begin_edit_assign" ClientSideGetText="on_column_gettext_assign"--%>
<EditorTemplate>
<select ID="assign_dropdown"
style="font-family: Veranda; font-size:8pt; width: 109px;">
<option>-Please Select-</option>
<asp:Repeater ID="GL_type" runat="server">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "scode")%>'>
<%--datafield from sp--%><%#DataBinder.Eval(Container.DataItem, "scode_fmt")%>
<%--datafield from sp--%></option>
</ItemTemplate>
</asp:Repeater>
</select>
</EditorTemplate>
</eo:CustomColumn>
<eo:CustomColumn AllowSort="True" ClientSideBeginEdit="on_begin_edit_assign1"
ClientSideEndEdit="on_end_edit_assign1"
ClientSideGetText="on_column_gettext_assign1" DataField="OTAcct"
HeaderText="Overtime Account" Width="250">
<%--ClientSideEndEdit="on_end_edit_assign" ClientSideBeginEdit="on_begin_edit_assign" ClientSideGetText="on_column_gettext_assign"--%>
<EditorTemplate>
<select ID="assign_dropdown"
style="font-family: Veranda; font-size:8pt; width: 109px;">
<option>-Please Select-</option>
<asp:Repeater ID="OT_type" runat="server">
<ItemTemplate>
<option value='<%#DataBinder.Eval(Container.DataItem, "scode")%>'>
<%--datafield from sp--%><%#DataBinder.Eval(Container.DataItem, "scode_fmt")%>
<%--datafield from sp--%></option>
</ItemTemplate>
</asp:Repeater>
</select>
</EditorTemplate>
</eo:CustomColumn>
<%-- <eo:StaticColumn DataField="OTAcct" HeaderText="Overtime Account" Name="" Width="200">
</eo:StaticColumn>--%>
<eo:StaticColumn DataField="ID" HeaderText="DeleteId" Name="" Visible="False">
</eo:StaticColumn>
</Columns>
<ColumnTemplates>
<eo:TextBoxColumn>
<TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
</eo:TextBoxColumn>
</ColumnTemplates>
<FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
</eo:Grid>

Any help would be greatly appreciated
eo_support
Posted: Wednesday, April 25, 2012 11:56:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

You can't do it that way. Our Grid is very much a client side Grid and it doesn't take any server side data binding syntax. What you can do is to produce an additional data field in your data source that would contain a "column style". The value of that column would be a CSS style name. You would have different CSS style name based on your data. That allows you to apply different CSS style to different cells based on data of that cell or other cell on that row. See here for a working example and more details about this approach:

http://demo.essentialobjects.com/Demos/Grid/Features/Conditional%20Formatting%20-%20Cell%20Based/Demo.aspx

This example shows red for negative numbers. However you can easily add "display:none" in your CSS style so that instead of showing them as red, you would hide it.

Hope this helps. Please feel free to let us know if you have any more questions.

Thanks!
Mike_C
Posted: Wednesday, April 25, 2012 11:57:45 AM
Rank: Newbie
Groups: Member

Joined: 4/4/2012
Posts: 8
Thank you sir
Mike_C
Posted: Wednesday, April 25, 2012 2:02:11 PM
Rank: Newbie
Groups: Member

Joined: 4/4/2012
Posts: 8
To get it to work I had to do this: In the data set for the stored procedure (my_SP_gl_xref_list) I returned an extra field called say Style. In this field I put a “Y” (any value basically) for every field but the “ck chg” and “Lifestyle” field (fields I did not want to apply the style to). When it is returned in the data set The Button column's StyleField is set to "Style" (the dataset field name) This tells the Grid to populate the value in "Style" (from the dataset)to each cell's Style property. the CSS needs to be the value of the field from the dataset - in other words .Y {display:none;} At runtime, the Grid applies each cell's Style property on each cell. If Style is empty, which is the case would be null, no additional style is applied.
I know thats what you said in the online help but I tried to simplify it for us newbies :) Thanks it worked like a champ
eo_support
Posted: Wednesday, April 25, 2012 2:08:07 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Yes. That's how it works. It's great that you put it together with a real sample. Thanks for sharing!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.