Welcome Guest Search | Active Topics | Sign In | Register

Checkbox not displaying in grid Options
PMAC
Posted: Friday, May 15, 2009 2:23:08 PM
Rank: Member
Groups: Member

Joined: 4/15/2009
Posts: 14
I have a child web page with grid containg three checkbox columns. i am populating the grid with a dataset. Although the columns display in the grid at runtime, the checkboxes do not reguardless of the dataset value.

THE PAGE:
Code: HTML/ASPX
<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true" CodeBehind="CareerServicesHome.aspx.cs" Inherits="ECACommunityPortal.CareerServicesHome" %>
<%@ Register Assembly="EO.Web, Version=6.0.72.2, Culture=neutral, PublicKeyToken=e92353a6bf73fffc" Namespace="EO.Web" TagPrefix="eo" %>


<asp:Content ID="PageContents" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <script language="javascript" type="text/javascript">
        function itemcommand_handler(grid, itemIndex, colIndex, commandName)
        {
            window.open("mypage.aspx?id=" + grid.getItem(itemIndex).getKey(), "_self");
        }


        function OnItemCommand(grid, itemIndex, colIndex, commandName)
        {
            var item = grid.getItem(itemIndex);
            var cell = item.getCell(0);
            window.open("EmployerContact.aspx?EmployerId=" + cell.getValue());
        }


        function checkAllColumns(gridId, columnIndex) {
            //Get the grid object
            var grid = eo_GetObject(gridId);
            for (var i = 0; i < grid.getItemCount(); i++) {
                //Get the grid item
                var item = grid.getItem(i);

                //Get the cell for the checkbox column
                var cell = item.getCell(columnIndex);

                //Check it
                cell.setValue("1");
            }
        }
    </script>


    <div class="nav">
        <a href="CareerServicesHome.aspx">HOME</a> | 
        <a href="">STUDENTS</a> | 
        <a href="">EMPLOYERS</a> | 
        <a href="">OTHER</a> |
        <a href="Login.aspx">LOG OUT</a> 
    </div>
    <div id="Content" class="content">
        <div class="H1Div">
            <h2><asp:Label ID="PortalName" runat="server" Text="Career Servcies Portal"></asp:Label></h2>
            <asp:Label ID="lblUser" runat="server" Text="User Name"></asp:Label>
            <asp:Label ID="lblCampus" runat="server" Text="Campus Name"></asp:Label>
        </div>
        <div>
        <fieldset class="girdfieldset"><legend class="vclegend">Employer List</legend><br />
            <eo:Grid ID="grid_Employers" runat="server" BorderColor="Black" BorderWidth="1px" 
                ColumnHeaderAscImage="00050403" ColumnHeaderDescImage="00050404" 
                ColumnHeaderDividerImage="00050402" ColumnHeaderDividerOffset="6" 
                ColumnHeaderHeight="18" FixedColumnCount="1" Font-Bold="False" 
                Font-Italic="False" Font-Names="Verdana" Font-Overline="False" Font-Size="9pt" 
                Font-Strikeout="False" Font-Underline="False" GridLineColor="240, 240, 240" 
                GridLines="Both" Height="200px" ItemHeight="18" KeyField="employer_id" 
                Width="650px" EnableKeyboardNavigation="True" ClientSideOnItemCommand="OnItemCommand">
                <FooterStyle CssText="padding-bottom:4px;padding-left:4px;padding-right:4px;padding-top:4px;" />
                <ItemStyles>
                    <eo:GridItemStyleSet>
                        <ItemStyle CssText="background-color: white" />
                        <CellStyle CssText="padding-left:8px;padding-top:2px; color:#black;white-space:nowrap;" />
                    </eo:GridItemStyleSet>
                </ItemStyles>
                <ColumnTemplates>
                    <eo:TextBoxColumn>
                        <TextBoxStyle CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 8.75pt; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; FONT-FAMILY: Tahoma" />
                    </eo:TextBoxColumn>
                    <eo:DateTimeColumn>
                        <DatePicker runat="server" ControlSkinID="None" DayCellHeight="16" DayCellWidth="19" DayHeaderFormat="FirstLetter" DisabledDates="" OtherMonthDayVisible="True" SelectedDates="" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon">
                            <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid" />
                            <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                            <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                            <PickerStyle CssText="border-bottom-color:#7f9db9;border-bottom-style:solid;border-bottom-width:1px;border-left-color:#7f9db9;border-left-style:solid;border-left-width:1px;border-right-color:#7f9db9;border-right-style:solid;border-right-width:1px;border-top-color:#7f9db9;border-top-style:solid;border-top-width:1px;font-family:Courier New;font-size:8pt;margin-bottom:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:1px;padding-left:2px;padding-right:2px;padding-top:2px;" />
                            <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma" />
                            <TitleArrowStyle CssText="cursor:hand" />
                            <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid" />
                            <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px" />
                            <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;" />
                            <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                            <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid" />
                            <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid" />
                        </DatePicker>
                    </eo:DateTimeColumn>
                    <eo:MaskedEditColumn>
                        <MaskedEdit runat="server" ControlSkinID="None" TextBoxStyle-CssText="BORDER-RIGHT: #7f9db9 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #7f9db9 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 1px; MARGIN: 0px; BORDER-LEFT: #7f9db9 1px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #7f9db9 1px solid; font-family:Courier New;font-size:8pt;"></MaskedEdit>
                    </eo:MaskedEditColumn>
                    <eo:CheckBoxColumn>
                        <CheckBoxStyle CssText="" />
                    </eo:CheckBoxColumn>
                </ColumnTemplates>
                <Columns>
                    <eo:StaticColumn DataField="employer_id" HeaderText="Id" Name="Id" Visible="False"></eo:StaticColumn>
                    <eo:RowNumberColumn Width="35">
                        <CellStyle CssText="text-align: center" />
                    </eo:RowNumberColumn>
                    <eo:CheckBoxColumn AllowSort="True" HeaderText="Approved" DataField="account_active" ReadOnly="True" Visible="true">
                        <CheckBoxStyle CssText="text-align: center" />
                        <CellStyle CssText="text-align: center" />
                    </eo:CheckBoxColumn>
                    <eo:ButtonColumn AllowResize="true" DataField="business_name" HeaderText="Business Name" Name="EditRecord" AllowSort="True" Width="300"></eo:ButtonColumn>
                    <eo:StaticColumn AllowSort="True" DataField="industry_name" HeaderText="Industry" Name="Industry" Width="200"></eo:StaticColumn>
                    <eo:CheckBoxColumn AllowSort="True" DataField="is_agency" HeaderText="Agency" Name="IsAgency">
                        <CheckBoxStyle CssText="text-align: center" />
                        <CellStyle CssText="text-align: center" />
                    </eo:CheckBoxColumn>
                    <eo:CheckBoxColumn AllowSort="True" DataField="hired_from_before" HeaderText="Hired Before" Name="HiredBefore">
                        <CheckBoxStyle CssText="text-align: center" />
                        <CellStyle CssText="text-align: center" />
                    </eo:CheckBoxColumn>
                    <eo:DateTimeColumn AllowSort="True" DataField="added_date" HeaderText="Date Added" Name="DateAdded" ReadOnly="True" DataFormat="{0:mm/dd/yyyy}">
                        <DatePicker runat="server" DayCellHeight="16" SelectedDates="" DisabledDates="" OtherMonthDayVisible="True" DayHeaderFormat="FirstLetter" TitleLeftArrowImageUrl="DefaultSubMenuIconRTL" TitleRightArrowImageUrl="DefaultSubMenuIcon" DayCellWidth="19" ControlSkinID="None">
                            <TodayStyle CssText="font-family: tahoma; font-size: 12px; border-right: #bb5503 1px solid; border-top: #bb5503 1px solid; border-left: #bb5503 1px solid; border-bottom: #bb5503 1px solid"></TodayStyle>
                            <SelectedDayStyle CssText="font-family: tahoma; font-size: 12px; background-color: #fbe694; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></SelectedDayStyle>
                            <DisabledDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DisabledDayStyle>
                            <PickerStyle CssText="font-family:Courier New; padding-left:5px; padding-right: 5px;"></PickerStyle>
                            <CalendarStyle CssText="background-color: white; border-right: #7f9db9 1px solid; padding-right: 4px; border-top: #7f9db9 1px solid; padding-left: 4px; font-size: 9px; padding-bottom: 4px; border-left: #7f9db9 1px solid; padding-top: 4px; border-bottom: #7f9db9 1px solid; font-family: tahoma"></CalendarStyle>
                            <TitleArrowStyle CssText="cursor:hand"></TitleArrowStyle>
                            <DayHoverStyle CssText="font-family: tahoma; font-size: 12px; border-right: #fbe694 1px solid; border-top: #fbe694 1px solid; border-left: #fbe694 1px solid; border-bottom: #fbe694 1px solid"></DayHoverStyle>
                            <MonthStyle CssText="font-family: tahoma; font-size: 12px; margin-left: 14px; cursor: hand; margin-right: 14px"></MonthStyle>
                            <TitleStyle CssText="background-color:#9ebef5;font-family:Tahoma;font-size:12px;padding-bottom:2px;padding-left:6px;padding-right:6px;padding-top:2px;"></TitleStyle>
                            <OtherMonthDayStyle CssText="font-family: tahoma; font-size: 12px; color: gray; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></OtherMonthDayStyle>
                            <DayHeaderStyle CssText="font-family: tahoma; font-size: 12px; border-bottom: #aca899 1px solid"></DayHeaderStyle>
                            <DayStyle CssText="font-family: tahoma; font-size: 12px; border-right: white 1px solid; border-top: white 1px solid; border-left: white 1px solid; border-bottom: white 1px solid"></DayStyle>
                        </DatePicker>
                    </eo:DateTimeColumn>
                </Columns>
                <ColumnHeaderStyle CssText="background-image:url('00050401');padding-left:8px;padding-top:2px;" />
            </eo:Grid>
        </fieldset>
        </div>
    </div>
</asp:Content>


CODE BEHIND:
Code: C#
DataSet dsEmployers = objUtility.GetEmployerList();
grid_Employers.DataSource = dsEmployers;
grid_Employers.DataBind();


I have checked the dataset at runtime to varify that it contains resords...

Any help would be appreciated


eo_support
Posted: Friday, May 15, 2009 2:36:37 PM
Rank: Administration
Groups: Administration

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

I am not sure whether the problem is that you do not see the checkbox at all; or you see the checkbox, but the checkbox is always unchecked regardless what you have in your database. Your code looks fine to us.

If you do not see checkbox at all, check whether you get row numbers in your RowNumberColumn (your second column). If you do see row number in that column, then the reason that you are not seeing the checkbox is mostly caused by styles. Try the Grid in a blank page without referencing any other style and see if it works for you.

If you do see checkbox but they are never checked, try to create a DataSet with code (you can find sample code in the demo project, under Menu/Data Binding) and populate the Grid from there. If that works and your dataset does not, then it should be very easy to find out what's causing the different behaviors.

If the problem continues, please create a test page that reproduces the problem. Make sure the test page runs independently (most likely you will need to create DataSet with code because we won't be able to run objUtility.getEmployerList here). Once we have the test page, we will then try to run and debug it here to see what we can find.

Thanks!


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.