This is a migrated thread and some comments may be shown as answers.

RadGrid not Displaying Data After Upgrading Telerik Rad Controls

3 Answers 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pmourfield
Top achievements
Rank 1
pmourfield asked on 13 Apr 2012, 03:31 PM
Good morning all. I was wondering if anyone else has has this problem. I upgraded my Rad AJAX Control dlls and suddenly my main RadGrid isn't working on one of my pages. Funny thing is the Grid works on all other pages. If I add the old dlls from the previous version it works perfectly. The markup and the back-end C# has not changed at all, just a simple upgrade. Any advice on how to fix this?

Josh

3 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 13 Apr 2012, 05:32 PM
Hello Josh,

Could you paste your complete aspx and code-behind, so we can test it locally? Please use the code formatter tool of the ticket editor (last option on the lower tool bar).

Regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
pmourfield
Top achievements
Rank 1
answered on 13 Apr 2012, 06:25 PM
<%@ Page Language="C#" AutoEventWireup="true" Inherits="GoalSlayer.WeeklyGoals" CodeBehind="WeeklyGoals.aspx.cs" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head id="Head1" runat="server">
    <title></title>
    <script src="scripts/jquery.min.js" type="text/javascript"></script>
    <telerik:RadStyleSheetManager ID="RadStyleSheetManager1" runat="server" />
    <link type="text/css" href="css/StyleSheet.css" rel="Stylesheet" />
    <style type="text/css">
        .pdfButton
        {
            color: black;
            cursor: pointer;
        }
    </style>
    <script type="text/javascript" language="javascript">
        function requestStart(sender, args) {
            if (args.get_eventTarget().indexOf("DownloadPDF") > 0)
                args.set_enableAjax(false);
        }
 
        function openNewWindow() {
            var windowURL = "WeeklyGoalsHelp.aspx";
            var oWnd = radopen(windowURL, null);
            oWnd.center();
        }
 
        function openMarkGoalCompleteWindow(goalID) {
            var windowURL = "MarkGoalCompleteWindow.aspx?goalID=" + goalID;
            var oWnd = radopen(windowURL, null);
            oWnd.center();
        }
 
        function disableEnterKey(e) {
            var key;
            if (window.event)
                key = window.event.keyCode; //IE
            else
                key = e.which; //firefox    
 
            return (key != 13);
        }
 
        //Confirmation for deletion of goals just to make you happy, Jason :)
        function confirmCallBackFn(sender, args) {
            var callBackFunction = Function.createDelegate(sender, function (argument) {
                if (argument) {
                    this.click();
                }
            });
            var text = "Are you sure?";
            radconfirm(text, callBackFunction, 300, 100, null, "Delete Goal?");
            args.set_cancel(true);
        }
         
    </script>
</head>
<body onkeypress="return disableEnterKey(event)">
    <form id="form1" runat="server">
    <div align="center" class="header">
        <div class="header_resize">
            <div class="menu_nav">
                <div style="float: left; margin-left: -10px; margin-right: 20px;">
                    <img src="images/goalslayer_logo.png" alt="" width="174" height="51" /></div>
                <ul>
                    <li><a href="Default.aspx">Home</a></li>
                    <li class="active"><a href="WeeklyGoals.aspx">Weekly Goals</a></li>
                    <li><a href="GoalLibrary.aspx">Goal Library</a></li>
                    <li><a href="AnnualGoals.aspx">Annual Goals</a></li>
                    <li>
                        <asp:HyperLink ID="ManagersPortalLink" runat="server" NavigateUrl="~/ManagersPortal.aspx"
                            Text="Manager's Portal" Enabled="false" Visible="false"></asp:HyperLink></li>
                    <li>
                        <asp:HyperLink ID="AdminPortalLink" runat="server" NavigateUrl="~/AdminPortal.aspx"
                            Text="Admin Portal" Enabled="false" Visible="false"></asp:HyperLink></li>
                    <li>
                        <asp:Image runat="server" ID="empImage" Height="55" Width="55" CssClass="roundedCornerImage" /></li>
                </ul>
            </div>
            <div class="clr">
            </div>
            <table style="float: right; font-size: 14px !important;">
                <tr>
                    <td>
                        <a href="#" onclick="openNewWindow()">Help</a>  | 
                    </td>
                    <td>
                        Comments: [<asp:HyperLink ID="commentsHyperLink" runat="server" Text="0" NavigateUrl="~/Comments.aspx"></asp:HyperLink>]
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div style="background-color: White; margin-top: 25px;">
        <table>
            <tr>
                <td style="float: right; display: none;">
                    <asp:HyperLink ID="userNameHyperLink" runat="server" NavigateUrl="#" Visible="false"
                        Style="text-decoration: none"></asp:HyperLink>
                </td>
            </tr>
        </table>
    </div>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        <CacheSettings Enabled="false" />
        <Scripts>
            <%--Needed for JavaScript IntelliSense in VS2010--%>
            <%--For VS2008 replace RadScriptManager with ScriptManager--%>
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />
            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />
        </Scripts>
    </telerik:RadScriptManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"
        Width="75px" Transparency="25">
        <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
            style="border: 0;" />
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />                   
                </UpdatedControls>               
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadNotification ID="RadNotification1" runat="server" VisibleOnPageLoad="false"
        Position="Center" ContentScrolling="Auto" AutoCloseDelay="0" Width="700" Height="600"
        Animation="Fade" EnableRoundedCorners="true" EnableShadow="true" ViewStateMode="Enabled"
        Title="Notification Title" Text="RadNotification is a a light control which can be used to display a notification message"
        Style="z-index: 35000">
        <ContentTemplate>
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                <div>
                </div>
                <div>
                    <asp:Panel ID="resultsPanel" runat="server"></asp:Panel>
                </div>
            </telerik:RadAjaxPanel>
        </ContentTemplate>
    </telerik:RadNotification>
    <div>
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="theSource" AllowPaging="true"
            AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true"
            ExportSettings-Pdf-AllowPrinting="true" ShowStatusBar="true" AllowSorting="true"
            AllowMultiRowEdit="true" OnDeleteCommand="RadGrid1_DeleteCommand" CellSpacing="0"
            GridLines="None" AutoGenerateColumns="false" OnItemCommand="RadGrid1_ItemCommand"
            OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand"
            OnItemInserted="RadGrid1_ItemInserted" OnItemDataBound="RadGrid1_ItemDataBound"
            PageSize="30">
            <ClientSettings>
                <Selecting AllowRowSelect="True" />
                <ClientEvents OnRowSelected="RowSelected" />
            </ClientSettings>
            <PagerStyle Mode="NextPrevAndNumeric" />
            <ExportSettings IgnorePaging="true" OpenInNewWindow="true">
                <Pdf PageHeight="210mm" PageWidth="297mm" PageTitle="Weekly Goals" DefaultFontFamily="Arial Unicode MS"
                    PageBottomMargin="20mm" PageTopMargin="20mm" PageLeftMargin="20mm" PageRightMargin="20mm" />
            </ExportSettings>
            <MasterTableView EditMode="EditForms" CommandItemDisplay="Top" DataKeyNames="GoalID"
                GroupsDefaultExpanded="false" GroupLoadMode="client" ShowGroupFooter="true">
                <CommandItemSettings AddNewRecordText="Add New Goal" />
                <%--<CommandItemTemplate>
                <asp:Button ID="DownloadPDF" runat="server" Width="100%" CommandName="ExportToPdf" Text="Export to PDF"
                    CssClass="pdfButton" />
            </CommandItemTemplate>--%>
                <GroupByExpressions>
                    <telerik:GridGroupByExpression>
                        <SelectFields>
                            <telerik:GridGroupByField FieldName="BeginDate" HeaderText="Begin Date" FormatString="{0:d}" />
                            <telerik:GridGroupByField FieldName="EndDate" HeaderText="End Date" FormatString="{0:d}" />
                        </SelectFields>
                        <GroupByFields>
                            <telerik:GridGroupByField FieldName="BeginDate" SortOrder="Descending" />
                            <telerik:GridGroupByField FieldName="EndDate" SortOrder="Descending" />
                        </GroupByFields>
                    </telerik:GridGroupByExpression>
                </GroupByExpressions>
                <Columns>
                    <telerik:GridEditCommandColumn>                       
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="GoalID" ReadOnly="true" Display="false" HeaderText="GoalID">
                    </telerik:GridBoundColumn>
                    <telerik:GridDateTimeColumn DataField="BeginDate" HeaderText="Begin Date" DataFormatString="{0:d}">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridDateTimeColumn DataField="EndDate" HeaderText="End Date" DataFormatString="{0:d}"
                        EditFormColumnIndex="1">
                    </telerik:GridDateTimeColumn>
                    <telerik:GridBoundColumn DataField="GoalName" UniqueName="goalNameTextBox" HeaderText="Goal Name">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="WeeklyGoal" HeaderText="Goal Description" EditFormColumnIndex="1" Display="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="TotalGoalHours" HeaderText="Hours Total per Goal"
                        Aggregate="Sum" FooterAggregateFormatString="Total Goal Set Hours: {0}" FooterText="Total Hours">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="GoalComplete" HeaderText="Goal Complete?"
                        EditFormColumnIndex="2" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>                                           
                    <telerik:GridBoundColumn DataField="Task1" Display="false" HeaderText="Step 1">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T1Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task2" Display="false" HeaderText="Step 2">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T2Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task3" Display="false" HeaderText="Step 3">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T3Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task4" Display="false" HeaderText="Step 4">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T4Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task5" Display="false" HeaderText="Step 5">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T5Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task6" Display="false" HeaderText="Step 6">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T6Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task7" Display="false" HeaderText="Step 7">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T7Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task8" Display="false" HeaderText="Step 8">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T8Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task9" Display="false" HeaderText="Step 9">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T9Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                    <telerik:GridBoundColumn DataField="Task10" Display="false" HeaderText="Step 10">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="T10Complete" Display="false" HeaderText="Complete"
                        EditFormColumnIndex="0" DefaultInsertValue="false">
                    </telerik:GridCheckBoxColumn>
                </Columns>
                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                </ExpandCollapseColumn>
                <EditFormSettings InsertCaption="Add New Goal" ColumnNumber="3" EditFormType="Template">
                    <FormTemplate>
                        <asp:CompareValidator SetFocusOnError="true" runat="server" Style="color: Red" ID="dateCompareValidator"
                            Operator="GreaterThan" ControlToCompare="beginDatePicker" ControlToValidate="endDatePicker"
                            ErrorMessage="The End Date must be greater than the Begin Date"></asp:CompareValidator>
                        <table id="dateControlsTable" cellspacing="2" cellpadding="2" border="0" rules="none"
                            style="border-collapse: collapse;">
                            <tr>
                                <td>
                                    <%--This is going to remain here just in case we want to bring the Working Saturday option back.
                                    Backend code does not need to change.--%>
                                    <%--<asp:CheckBox ID="workingSaturdayCB" runat="server" Text="Working Saturday?" />--%>
                                    <asp:RequiredFieldValidator runat="server" ID="beginDatePickerValidator" ForeColor="Red"
                                        Display="Dynamic" ControlToValidate="beginDatePicker" ErrorMessage="Begin Date is required."
                                        SetFocusOnError="true"></asp:RequiredFieldValidator>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator runat="server" ID="endDatePickerValidator" ForeColor="Red"
                                        Display="Dynamic" ControlToValidate="endDatePicker" ErrorMessage="End Date is required."
                                        SetFocusOnError="true"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <strong>Begin Date:</strong>
                                    <telerik:RadDatePicker runat="server" DateInput-ReadOnly="false" ID="beginDatePicker"
                                        AutoPostBack="true" DbSelectedDate="<%# Bind('BeginDate') %>" Calendar-FirstDayOfWeek="Monday"
                                        OnSelectedDateChanged="beginDatePicker_SelectedDateChanged">
                                    </telerik:RadDatePicker>
                                </td>
                                <td>
                                    <strong>End Date:</strong>
                                    <telerik:RadDatePicker runat="server" DateInput-ReadOnly="false" ID="endDatePicker"
                                        DbSelectedDate="<%# Bind('EndDate') %>">
                                    </telerik:RadDatePicker>
                                </td>
                                <td>
                                    <telerik:RadComboBox ID="TemplateDropDown" runat="server" AppendDataBoundItems="True"
                                        EmptyMessage="Personal Goal Libary" AutoPostBack="True" CssClass="templateDropDown"
                                        CausesValidation="false" OnSelectedIndexChanged="TemplateDropDown_SelectedIndexChanged"
                                        ViewStateMode="Enabled">
                                    </telerik:RadComboBox>
                                </td>
                                <td>
                                    <telerik:RadComboBox ID="IncompleteGoalsDropDown" runat="server" AppendDataBoundItems="true"
                                        EmptyMessage="Incomplete Goals" AutoPostBack="true" CssClass="templateDropDown"
                                        CausesValidation="false" ViewStateMode="Enabled" DropDownWidth="600px" HighlightTemplatedItems="true"
                                        OnSelectedIndexChanged="IncompleteGoalsDropDown_SelectedIndexChanged">
                                        <HeaderTemplate>
                                            <table style="width: 475px" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        Incomplete Goals
                                                    </td>
                                                </tr>
                                            </table>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <table style="width: 475px" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <strong>Goal Name</strong>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 100%">
                                                        <%# DataBinder.Eval(Container, "Attributes['GoalName']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <strong>Description</strong>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['WeeklyGoal']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task1']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T1EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task2']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T2EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task3']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T3EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task4']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T4EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task5']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T5EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task6']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T6EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task7']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T7EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task8']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T8EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task9']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T9EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task10']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T10EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                            </table>
                                            <br />
                                            <br />
                                        </ItemTemplate>
                                    </telerik:RadComboBox>
                                </td>
                                <td>
                                    <asp:HiddenField runat="server" ID="goalIDHF" Value="<%# Bind('GoalID') %>" />
                                </td>
                            </tr>
                        </table>
                        <p>
                        </p>
                        <table id="goalDataTable" cellspacing="2" cellpadding="2" border="0" rules="none"
                            style="border-collapse: collapse;">
                            <tr>
                                <td>
                                    <strong>Goal Name:</strong>
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="goalNameTextBox" Text="<%# Bind('GoalName') %>"
                                        EmptyMessage="A short name for the weekly goal..." EmptyMessageStyle-Font-Italic="true"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:RequiredFieldValidator runat="server" ID="goalNameTextBoxValidator" Display="Dynamic"
                                        ErrorMessage="Goal Name is required" ForeColor="Red" ControlToValidate="goalNameTextBox"></asp:RequiredFieldValidator>
                                </td>
                                <td>
                                    <strong>Goal Complete:</strong>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="goalCompleteCheckBox" Checked="<%# Bind('GoalComplete') %>" />
                                </td>
                                <td>
                                    <strong>Division Search</strong>
                                </td>
                                <td>
                                </td>
                                <td>
                                    <strong>Advanced Search</strong>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <strong>Goal Description:</strong>
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="goalDescriptionTextBox" Text="<%# Bind('WeeklyGoal') %>"
                                        EmptyMessage="A longer description of the weekly goal..." EmptyMessageStyle-Font-Italic="true"
                                        Width="500">
                                    </telerik:RadTextBox>
                                </td>
                                <td>
                                </td>
                                <td>
                                </td>
                                <td>
                                    <telerik:RadTextBox ID="keywordsTextBox" runat="server" EmptyMessage="Keywords...">
                                    </telerik:RadTextBox>
                                </td>
                                <td>
                                    <telerik:RadButton ID="searchButton" runat="server" Text="Search" OnClick="searchButton_Click"
                                        CausesValidation="false">
                                    </telerik:RadButton>
                                </td>
                                <td>
                                    <telerik:RadComboBox runat="server" ID="divisionGoalsComboBox" AutoPostBack="true"
                                        Height="500px" CausesValidation="false" Width="200px" DropDownWidth="600px" EmptyMessage="Division Goals"
                                        HighlightTemplatedItems="true" EnableLoadOnDemand="true" Filter="Contains" OnItemsRequested="divisionGoalsComboBox_ItemsRequested"
                                        OnItemCreated="divisionGoalsComboBox_ItemCreated" OnSelectedIndexChanged="divisionGoalsComboBox_SelectedIndexChanged">
                                        <HeaderTemplate>
                                            <table style="width: 475px" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        Division Goal Templates
                                                    </td>
                                                </tr>
                                            </table>
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <table style="width: 475px" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <strong>Goal Name</strong>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 100%">
                                                        <%# DataBinder.Eval(Container, "Attributes['GoalName']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <strong>Description</strong>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['WeeklyGoal']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task1']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T1EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task2']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T2EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task3']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T3EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task4']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T4EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task5']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T5EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task6']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T6EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task7']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T7EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task8']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T8EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task9']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T9EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['Task10']") %>
                                                    </td>
                                                    <td>
                                                        <%# DataBinder.Eval(Container, "Attributes['T10EstimatedHours']") %>
                                                    </td>
                                                </tr>
                                            </table>
                                            <br />
                                            <br />
                                        </ItemTemplate>
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <strong>Steps</strong>
                                </td>
                                <td>
                                </td>
                                <td>
                                    <strong>Hours</strong>
                                </td>
                                <td style="text-align: center">
                                    <strong>Complete</strong>
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    1.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step1TextBox" Text="<%# Bind('Task1') %>"
                                        EmptyMessage="List the steps that will help you accomplish this weekly goal..."
                                        EmptyMessageStyle-Font-Italic="true" Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step1TextBox_val" ControlToValidate="step1TextBox"
                                        ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step1TextBox_hrs" Text="<%# Bind('T1EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step1TextBox_chk" Checked="<%# Bind('T1Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    2.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step2TextBox" Text="<%# Bind('Task2') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step2TextBox_val" ControlToValidate="step2TextBox"
                                        ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step2TextBox_hrs" Text="<%# Bind('T2EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step2TextBox_chk" Checked="<%# Bind('T2Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    3.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step3TextBox" Text="<%# Bind('Task3') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step3TextBox_val" ControlToValidate="step3TextBox"
                                        ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step3TextBox_hrs" Text="<%# Bind('T3EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step3TextBox_chk" Checked="<%# Bind('T3Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    4.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step4TextBox" Text="<%# Bind('Task4') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step4TextBox_val" ControlToValidate="step4TextBox"
                                        ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step4TextBox_hrs" Text="<%# Bind('T4EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step4TextBox_chk" Checked="<%# Bind('T4Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    5.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step5TextBox" Text="<%# Bind('Task5') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step5TextBox_val" ControlToValidate="step5TextBox"
                                        Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        ForeColor="Red" OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step5TextBox_hrs" Text="<%# Bind('T5EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step5TextBox_chk" Checked="<%# Bind('T5Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    6.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step6TextBox" Text="<%# Bind('Task6') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step6TextBox_val" ControlToValidate="step6TextBox"
                                        Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        ForeColor="Red" OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step6TextBox_hrs" Text="<%# Bind('T6EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step6TextBox_chk" Checked="<%# Bind('T6Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    7.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step7TextBox" Text="<%# Bind('Task7') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step7TextBox_val" ControlToValidate="step7TextBox"
                                        Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        ForeColor="Red" OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step7TextBox_hrs" Text="<%# Bind('T7EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step7TextBox_chk" Checked="<%# Bind('T7Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    8.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step8TextBox" Text="<%# Bind('Task8') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step8TextBox_val" ControlToValidate="step8TextBox"
                                        Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        ForeColor="Red" OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step8TextBox_hrs" Text="<%# Bind('T8EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step8TextBox_chk" Checked="<%# Bind('T8Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    9.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step9TextBox" Text="<%# Bind('Task9') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step9TextBox_val" ControlToValidate="step9TextBox"
                                        Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        ForeColor="Red" OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step9TextBox_hrs" Text="<%# Bind('T9EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step9TextBox_chk" Checked="<%# Bind('T9Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td style="float: right">
                                    10.
                                </td>
                                <td>
                                    <telerik:RadTextBox runat="server" ID="step10TextBox" Text="<%# Bind('Task10') %>"
                                        Width="500">
                                    </telerik:RadTextBox><br />
                                    <asp:CustomValidator runat="server" ID="step10TextBox_val" ControlToValidate="step10TextBox"
                                        Display="Dynamic" SetFocusOnError="true" ErrorMessage="" ValidateEmptyText="true"
                                        ForeColor="Red" OnServerValidate="ValidateStepTextBox"></asp:CustomValidator>
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="step10TextBox_hrs" Text="<%# Bind('T10EstimatedHours') %>"
                                        ShowSpinButtons="false" IncrementSettings-InterceptArrowKeys="true" IncrementSettings-InterceptMouseWheel="true"
                                        MaxValue="40" MaxLength="5" MinValue="0" Width="70" ClientEvents-OnBlur="runCalc">
                                    </telerik:RadNumericTextBox>
                                </td>
                                <td style="text-align: center">
                                    <asp:CheckBox runat="server" ID="step10TextBox_chk" Checked="<%# Bind('T10Complete') %>" />
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2">
                                    <telerik:RadButton ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Save" : "Update" %>'
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
                                    </telerik:RadButton>
                                     <telerik:RadButton ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                        UseSubmitBehavior="false" CommandName="Cancel">
                                    </telerik:RadButton>
                                     <telerik:RadButton ID="btnDelete" Text="Delete" runat="server" CausesValidation="false" OnClientClicking="confirmCallBackFn"
                                        CommandName="Delete" />
                                </td>
                                <td>
                                    <telerik:RadNumericTextBox runat="server" ID="runningTotalGoalHours" Width="49" Value="0"
                                        CssClass="runningTotalGoalHours" AllowOutOfRangeAutoCorrect="true" MaxValue="40"
                                        Enabled="false">
                                    </telerik:RadNumericTextBox>
                                </td>
                            </tr>
                        </table>
                        <telerik:RadSpell ID="SpellChecker" runat="server" Font-Underline="true" ControlsToCheck="goalNameTextBox,goalDescriptionTextBox,step1TextBox,step2TextBox,step3TextBox,step4TextBox,step5TextBox,step6TextBox,step7TextBox,step8TextBox,step9TextBox,step10TextBox"
                            DictionaryPath="dictionary" SpellCheckProvider="PhoneticProvider" SupportedLanguages="en-US,English" />
                    </FormTemplate>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
        <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
            <script type="text/javascript">
                function runCalc() {
                    //the following uses Jquery's endswith functionality to find the appropriate
                    //textboxes. Their ids are named differently depending on which mode they are in.
 
                    var value1 = $('input[name$="step1TextBox_hrs_text"]').val();
                    var value2 = $('input[name$="step2TextBox_hrs_text"]').val();
                    var value3 = $('input[name$="step3TextBox_hrs_text"]').val();
                    var value4 = $('input[name$="step4TextBox_hrs_text"]').val();
                    var value5 = $('input[name$="step5TextBox_hrs_text"]').val();
                    var value6 = $('input[name$="step6TextBox_hrs_text"]').val();
                    var value7 = $('input[name$="step7TextBox_hrs_text"]').val();
                    var value8 = $('input[name$="step8TextBox_hrs_text"]').val();
                    var value9 = $('input[name$="step9TextBox_hrs_text"]').val();
                    var value10 = $('input[name$="step10TextBox_hrs_text"]').val();
 
                    var sum = add(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10);
                    //document.getElementById('RadGrid1_ctl00_ctl02_ctl03_runningTotalGoalHours_text').value = sum;
                    $('input[name$="runningTotalGoalHours_text"]').val(sum)
 
                    function add() {
                        var sum = 0;
                        for (var i = 0, j = arguments.length; i < j; i++) {
                            if (IsNumeric(arguments[i])) {
                                sum += parseFloat(arguments[i]);
                            }
                        }
                        return sum;
                    }
                    function IsNumeric(input) {
                        return (input - 0) == input && input.length > 0;
                    }
                }
 
                function RowSelected(sender, eventArgs) {
                    var grid = sender;
                    var MasterTable = grid.get_masterTableView(); var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
                    var cell = MasterTable.getCellByColumnUniqueName(row, "GoalID");
                    openMarkGoalCompleteWindow(cell.innerHTML);
                }               
            </script>
        </telerik:RadCodeBlock>
        <asp:TextBox ID="UserNameTextBox" runat="server" Visible="false"></asp:TextBox>
        <asp:SqlDataSource ID="theSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnString %>"
            ProviderName="System.Data.SqlClient" InsertCommandType="StoredProcedure" InsertCommand="InsertWeeklyGoal"
            SelectCommandType="StoredProcedure" SelectCommand="DisplayWeeklyGoals" DeleteCommandType="StoredProcedure"
            DeleteCommand="DeleteWeeklyGoals" UpdateCommandType="StoredProcedure" UpdateCommand="UpdateWeeklyGoal"
            OnInserting="theSource_Inserting" OnUpdating="theSource_Updating" OnDeleting="theSource_Deleting">
            <SelectParameters>
                <asp:ControlParameter Name="UserName" DbType="String" ControlID="UserNameTextBox"
                    PropertyName="Text" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="GoalID" DbType="String" />
                <asp:Parameter Name="UserName" DbType="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:ControlParameter Name="UserName" DbType="String" ControlID="UserNameTextBox"
                    PropertyName="Text" />
                <asp:Parameter Name="BeginDate" DbType="DateTime" />
                <asp:Parameter Name="EndDate" DbType="DateTime" />
                <asp:Parameter Name="GoalName" DbType="String" />
                <asp:Parameter Name="WeeklyGoal" Type="String" />
                <asp:Parameter Name="Task1" DbType="String" />
                <asp:Parameter Name="Task2" DbType="String" />
                <asp:Parameter Name="Task3" DbType="String" />
                <asp:Parameter Name="Task4" DbType="String" />
                <asp:Parameter Name="Task5" DbType="String" />
                <asp:Parameter Name="Task6" DbType="String" />
                <asp:Parameter Name="Task7" DbType="String" />
                <asp:Parameter Name="Task8" DbType="String" />
                <asp:Parameter Name="Task9" DbType="String" />
                <asp:Parameter Name="Task10" DbType="String" />
                <asp:Parameter Name="T1EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T2EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T3EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T4EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T5EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T6EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T7EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T8EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T9EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T10EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
            </InsertParameters>
            <UpdateParameters>
                <asp:ControlParameter Name="UserName" DbType="String" ControlID="UserNameTextBox"
                    PropertyName="Text" />
                <asp:Parameter Name="GoalID" DbType="Int32" />
                <asp:Parameter Name="BeginDate" DbType="DateTime" />
                <asp:Parameter Name="EndDate" DbType="DateTime" />
                <asp:Parameter Name="GoalName" DbType="String" />
                <asp:Parameter Name="WeeklyGoal" DbType="String" />
                <asp:Parameter Name="Task1" DbType="String" />
                <asp:Parameter Name="Task2" DbType="String" />
                <asp:Parameter Name="Task3" DbType="String" />
                <asp:Parameter Name="Task4" DbType="String" />
                <asp:Parameter Name="Task5" DbType="String" />
                <asp:Parameter Name="Task6" DbType="String" />
                <asp:Parameter Name="Task7" DbType="String" />
                <asp:Parameter Name="Task8" DbType="String" />
                <asp:Parameter Name="Task9" DbType="String" />
                <asp:Parameter Name="Task10" DbType="String" />
                <asp:Parameter Name="T1EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T2EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T3EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T4EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T5EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T6EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T7EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T8EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T9EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="T10EstimatedHours" DbType="Decimal" DefaultValue="0.00" />
                <asp:Parameter Name="GoalComplete" DbType="Boolean" />
                <asp:Parameter Name="T1Complete" DbType="Boolean" />
                <asp:Parameter Name="T2Complete" DbType="Boolean" />
                <asp:Parameter Name="T3Complete" DbType="Boolean" />
                <asp:Parameter Name="T4Complete" DbType="Boolean" />
                <asp:Parameter Name="T5Complete" DbType="Boolean" />
                <asp:Parameter Name="T6Complete" DbType="Boolean" />
                <asp:Parameter Name="T7Complete" DbType="Boolean" />
                <asp:Parameter Name="T8Complete" DbType="Boolean" />
                <asp:Parameter Name="T9Complete" DbType="Boolean" />
                <asp:Parameter Name="T10Complete" DbType="Boolean" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </div>
    <div class="cleaner">
    </div>
    <div align="center" class="footertext">
        <a href="Default.aspx">Home</a> | <a href="WeeklyGoals.aspx">Weekly Goals</a> |
        <a href="GoalLibrary.aspx">Goal Library</a> | <a href="AnnualGoals.aspx">Annual
            Goals</a> |
        <asp:HyperLink ID="BottomManagersPortalLink" runat="server" Text="Managers Portal"
            Enabled="false" Visible="false" NavigateUrl="~/ManagersPortal.aspx"></asp:HyperLink> |
        <asp:HyperLink ID="BottomAdminPortalLink" runat="server" Text="Admin Portal" Enabled="false"
            Visible="false" NavigateUrl="~/AdminPortal.aspx"></asp:HyperLink>
        <span style="color: Black;">
            <br />
            Â© 2011 RHODES FINANCIAL SERVICES, INC. - All Rights Reserved </span>
    </div>
    <telerik:RadWindowManager EnableShadow="true" Behaviors="Close, Move, Resize,Maximize"
        ID="RadWindowManager" DestroyOnClose="true" RestrictionZoneID="RestrictionZone"
        runat="server" Width="800" Height="500">
        <Windows>
            <telerik:RadWindow runat="server" ID="helpWindow" VisibleOnPageLoad="false" Title="Weekly Goals Help">               
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>   
    </form>
</body>
</html>

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using Telerik.Web.UI;
using System.Data.SqlClient;
 
namespace GoalSlayer
{
    public partial class WeeklyGoals : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            UserNameTextBox.Text = GoalSlayer.ActiveDirectoryUser.UserName(User);
            userNameHyperLink.Text = "     " + GoalSlayer.ActiveDirectoryUser.Name(GoalSlayer.ActiveDirectoryUser.UserName(User));
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
            GoalSlayer.commentsChecker cc = new GoalSlayer.commentsChecker();
            commentsHyperLink.Text = cc.commentsCount(GoalSlayer.ActiveDirectoryUser.UserName(User));
 
            if (GoalSlayerManager.IsManager(User))
            {
                ManagersPortalLink.Visible = true;
                ManagersPortalLink.Enabled = true;
                BottomManagersPortalLink.Visible = true;
                BottomManagersPortalLink.Enabled = true;
            }
            if (GoalSlayerAdministrator.IsAdmin(User))
            {
                AdminPortalLink.Visible = true;
                AdminPortalLink.Enabled = true;
                BottomAdminPortalLink.Visible = true;
                BottomAdminPortalLink.Enabled = true;
            }
 
            empImage.ImageUrl = "~/images/employees/" + GoalSlayer.ActiveDirectoryUser.UserName(User) + ".jpg";
 
            //need to reset the current page index back to 1 each time given that new records are in decending order.
            RadGrid1.CurrentPageIndex = '1';
 
            if (!IsPostBack)
            {
                foreach (GridItem item in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
                {
                    if (item is GridGroupHeaderItem)
                    {
                        if (item.GroupIndex == "0")
                        {
                            item.Expanded = true;
                        }
                        else
                        {
                            item.Expanded = false;
                        }
                    }
                }
            }
        }
 
        //This is necessary in order that the Insert command doesn't try to bind something that isn't there.
        protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == RadGrid.InitInsertCommandName) //Add new button clicked
                {
                    RadGrid1.MasterTableView.ShowHeader = false;
                    GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
                    editColumn.Visible = false;
                    e.Canceled = true;
 
                    System.Collections.Specialized.ListDictionary newValues = new System.Collections.Specialized.ListDictionary();
                    newValues["GoalComplete"] = false;
                    newValues["T1Complete"] = false;
                    newValues["T2Complete"] = false;
                    newValues["T3Complete"] = false;
                    newValues["T4Complete"] = false;
                    newValues["T5Complete"] = false;
                    newValues["T6Complete"] = false;
                    newValues["T7Complete"] = false;
                    newValues["T8Complete"] = false;
                    newValues["T9Complete"] = false;
                    newValues["T10Complete"] = false;
 
                    e.Item.OwnerTableView.InsertItem(newValues);
                }
                else if (e.CommandName == RadGrid.EditCommandName) //Edit button clicked
                {
                    RadGrid1.MasterTableView.ShowHeader = false;
                }
                else if (e.CommandName == RadGrid.CancelCommandName) //Cancel button clicked
                {
                    GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
                    editColumn.Visible = true;
                    RadGrid1.MasterTableView.ShowHeader = true;
                }
                 
            }
            catch (Exception)
            {
 
            }
        }
 
        protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
        {
        }
 
        protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
        {
        }
 
        protected void RadGrid1_DeleteCommand(object sender, GridCommandEventArgs e)
        {
        }
 
        private string GetConnectionString()
        {
            return ConfigurationManager.AppSettings["SQLConn"];
        }
 
        public string GetUserName()
        {
            return GoalSlayer.ActiveDirectoryUser.UserName(User);
        }
        protected void theSource_Updating(object sender, SqlDataSourceCommandEventArgs e)
        {
 
        }
        protected void theSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)
        {
            e.Command.Parameters.RemoveAt("@GoalID"); //radgrid tries to send ALL parameters in the automatic insert table it builds. have to remove goalID
        }
        protected void RadGrid1_ItemInserted(object sender, GridInsertedEventArgs e)
        {
            GridEditCommandColumn editColumn = (GridEditCommandColumn)RadGrid1.MasterTableView.GetColumn("EditCommandColumn");
            editColumn.Visible = true;
            RadGrid1.MasterTableView.ShowHeader = true;
        }
        protected void theSource_Deleting(object sender, SqlDataSourceCommandEventArgs e)
        {
 
        }
        protected void TemplateDropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            RadComboBox TemplateDropDown = (RadComboBox)sender;
 
            if (TemplateDropDown.SelectedIndex >= 0)
            {
                string templateID = TemplateDropDown.SelectedItem.Value.ToString();
                string templateName = TemplateDropDown.SelectedItem.Text.ToString();
 
                DataTable dt = new DataTable();
                SqlConnection connection = new SqlConnection(GetConnectionString());
                try
                {
                    connection.Open();
                    SqlCommand cmd = new SqlCommand("RetrieveWeeklyGoalTemplate", connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@GoalID", templateID);
                    cmd.Parameters.AddWithValue("@TemplateName", templateName);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
 
                    da.Fill(dt);
                    if (dt.Rows.Count >= 0)  //the greater than or equal to is necessary to delete the last row in the gridview.
                    {
                        System.Collections.Specialized.ListDictionary templateValues = new System.Collections.Specialized.ListDictionary();
 
                        templateValues["goalNameTextBox"] = dt.Rows[0]["TemplateName"].ToString();
                        templateValues["goalDescriptionTextBox"] = dt.Rows[0]["WeeklyGoal"].ToString();
                        templateValues["step1TextBox"] = dt.Rows[0]["Task1"].ToString();
                        templateValues["step2TextBox"] = dt.Rows[0]["Task2"].ToString();
                        templateValues["step3TextBox"] = dt.Rows[0]["Task3"].ToString();
                        templateValues["step4TextBox"] = dt.Rows[0]["Task4"].ToString();
                        templateValues["step5TextBox"] = dt.Rows[0]["Task5"].ToString();
                        templateValues["step6TextBox"] = dt.Rows[0]["Task6"].ToString();
                        templateValues["step7TextBox"] = dt.Rows[0]["Task7"].ToString();
                        templateValues["step8TextBox"] = dt.Rows[0]["Task8"].ToString();
                        templateValues["step9TextBox"] = dt.Rows[0]["Task9"].ToString();
                        templateValues["step10TextBox"] = dt.Rows[0]["Task10"].ToString();
 
                        GridEditFormItem editItem = (GridEditFormItem)TemplateDropDown.NamingContainer;
                        RadTextBox goalNameTextBox = (RadTextBox)editItem.FindControl("goalNameTextBox");
                        RadTextBox goalDescriptionTextBox = (RadTextBox)editItem.FindControl("goalDescriptionTextBox");
                        RadTextBox step1TextBox = (RadTextBox)editItem.FindControl("step1TextBox");
                        RadTextBox step2TextBox = (RadTextBox)editItem.FindControl("step2TextBox");
                        RadTextBox step3TextBox = (RadTextBox)editItem.FindControl("step3TextBox");
                        RadTextBox step4TextBox = (RadTextBox)editItem.FindControl("step4TextBox");
                        RadTextBox step5TextBox = (RadTextBox)editItem.FindControl("step5TextBox");
                        RadTextBox step6TextBox = (RadTextBox)editItem.FindControl("step6TextBox");
                        RadTextBox step7TextBox = (RadTextBox)editItem.FindControl("step7TextBox");
                        RadTextBox step8TextBox = (RadTextBox)editItem.FindControl("step8TextBox");
                        RadTextBox step9TextBox = (RadTextBox)editItem.FindControl("step9TextBox");
                        RadTextBox step10TextBox = (RadTextBox)editItem.FindControl("step10TextBox");
                        RadNumericTextBox step1TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step1TextBox_hrs");
                        RadNumericTextBox step2TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step2TextBox_hrs");
                        RadNumericTextBox step3TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step3TextBox_hrs");
                        RadNumericTextBox step4TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step4TextBox_hrs");
                        RadNumericTextBox step5TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step5TextBox_hrs");
                        RadNumericTextBox step6TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step6TextBox_hrs");
                        RadNumericTextBox step7TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step7TextBox_hrs");
                        RadNumericTextBox step8TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step8TextBox_hrs");
                        RadNumericTextBox step9TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step9TextBox_hrs");
                        RadNumericTextBox step10TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step10TextBox_hrs");
                        goalNameTextBox.Text = dt.Rows[0]["TemplateName"].ToString();
                        goalDescriptionTextBox.Text = dt.Rows[0]["WeeklyGoal"].ToString();
                        step1TextBox.Text = dt.Rows[0]["Task1"].ToString();
                        step2TextBox.Text = dt.Rows[0]["Task2"].ToString();
                        step3TextBox.Text = dt.Rows[0]["Task3"].ToString();
                        step4TextBox.Text = dt.Rows[0]["Task4"].ToString();
                        step5TextBox.Text = dt.Rows[0]["Task5"].ToString();
                        step6TextBox.Text = dt.Rows[0]["Task6"].ToString();
                        step7TextBox.Text = dt.Rows[0]["Task7"].ToString();
                        step8TextBox.Text = dt.Rows[0]["Task8"].ToString();
                        step9TextBox.Text = dt.Rows[0]["Task9"].ToString();
                        step10TextBox.Text = dt.Rows[0]["Task10"].ToString();
                        step1TextBox_hrs.Text = dt.Rows[0]["T1EstimatedHours"].ToString();
                        step2TextBox_hrs.Text = dt.Rows[0]["T2EstimatedHours"].ToString();
                        step3TextBox_hrs.Text = dt.Rows[0]["T3EstimatedHours"].ToString();
                        step4TextBox_hrs.Text = dt.Rows[0]["T4EstimatedHours"].ToString();
                        step5TextBox_hrs.Text = dt.Rows[0]["T5EstimatedHours"].ToString();
                        step6TextBox_hrs.Text = dt.Rows[0]["T6EstimatedHours"].ToString();
                        step7TextBox_hrs.Text = dt.Rows[0]["T7EstimatedHours"].ToString();
                        step8TextBox_hrs.Text = dt.Rows[0]["T8EstimatedHours"].ToString();
                        step9TextBox_hrs.Text = dt.Rows[0]["T9EstimatedHours"].ToString();
                        step10TextBox_hrs.Text = dt.Rows[0]["T10EstimatedHours"].ToString();
                    }
                    TemplateDropDown.Items.Clear();
 
                    //The next few lines of code repopulate the Personal Goal Library dropdown after postback.
                    //The items must be cleared, like above, so that items are not continuously appended to the current list.
 
                    SqlConnection conn = new SqlConnection(GetConnectionString());
                    conn.Open();
                    SqlCommand command = new SqlCommand();
 
                    SqlDataReader templates;
 
                    command = new SqlCommand("DisplayWeeklyGoalsTemplatesForDropDown", conn);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter("@UserName", GoalSlayer.ActiveDirectoryUser.UserName(User)));
 
                    templates = command.ExecuteReader();
 
                    TemplateDropDown.DataSource = templates;
                    TemplateDropDown.DataValueField = "GoalID";
                    TemplateDropDown.DataTextField = "TemplateName";
                    TemplateDropDown.DataBind();
                    command.Connection.Close();
                    command.Connection.Dispose();
                }
                catch (System.Data.SqlClient.SqlException ex)
                {
                    string msg = "Fetch Error:";
                    msg += ex.Message;
                    throw new Exception(msg);
                }
                finally
                {
                    connection.Close();
                    connection.Dispose();
                }
            }
        }
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
            {
                GridEditFormItem editform = (GridEditFormItem)e.Item;
 
                //Fill the Template Drop down with the user's personal goal library templates
                RadComboBox TemplateDropDown = (RadComboBox)editform.FindControl("TemplateDropDown");
 
                SqlConnection connection = new SqlConnection(GetConnectionString());
                connection.Open();
                SqlCommand cmd = new SqlCommand();
 
                SqlDataReader templates;
 
                cmd = new SqlCommand("DisplayWeeklyGoalsTemplatesForDropDown", connection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@UserName", GoalSlayer.ActiveDirectoryUser.UserName(User)));
 
                templates = cmd.ExecuteReader();
 
                TemplateDropDown.DataSource = templates;
                TemplateDropDown.DataValueField = "GoalID";
                TemplateDropDown.DataTextField = "TemplateName";
                TemplateDropDown.DataBind();
                cmd.Connection.Close();
                cmd.Connection.Dispose();
 
                //Fill the Incomplete Goals Drop down with user's incomplete goals
                RadComboBox IncompleteGoalsDropDown = (RadComboBox)editform.FindControl("IncompleteGoalsDropDown");
 
                SqlConnection connection2 = new SqlConnection(GetConnectionString());
                connection2.Open();
                SqlCommand cmd2 = new SqlCommand();
 
                SqlDataReader incompletegoals;
 
                cmd2 = new SqlCommand("DisplayIncompleteWeeklyGoals", connection2);
                cmd2.CommandType = CommandType.StoredProcedure;
                cmd2.Parameters.Add(new SqlParameter("@UserName", GoalSlayer.ActiveDirectoryUser.UserName(User)));
                cmd2.Parameters.Add(new SqlParameter("@TodaysDate", DateTime.Now.ToShortDateString()));
 
                incompletegoals = cmd2.ExecuteReader();
 
 
                foreach (IDataRecord record in incompletegoals)
                {
                    RadComboBoxItem item = new RadComboBoxItem();
 
                    item.Text = "Goal Name" + (string)record["GoalName"];
                    item.Value = record["GoalID"].ToString();
 
                    string goalDescription = record["WeeklyGoal"].ToString();
                    string step1 = record["Task1"].ToString();
                    string step2 = record["Task2"].ToString();
                    string step3 = record["Task3"].ToString();
                    string step4 = record["Task4"].ToString();
                    string step5 = record["Task5"].ToString();
                    string step6 = record["Task6"].ToString();
                    string step7 = record["Task7"].ToString();
                    string step8 = record["Task8"].ToString();
                    string step9 = record["Task9"].ToString();
                    string step10 = record["Task10"].ToString();
                    string step1Hours = record["T1EstimatedHours"].ToString();
                    string step2Hours = record["T2EstimatedHours"].ToString();
                    string step3Hours = record["T3EstimatedHours"].ToString();
                    string step4Hours = record["T4EstimatedHours"].ToString();
                    string step5Hours = record["T5EstimatedHours"].ToString();
                    string step6Hours = record["T6EstimatedHours"].ToString();
                    string step7Hours = record["T7EstimatedHours"].ToString();
                    string step8Hours = record["T8EstimatedHours"].ToString();
                    string step9Hours = record["T9EstimatedHours"].ToString();
                    string step10Hours = record["T10EstimatedHours"].ToString();
 
                    item.Attributes.Add("GoalName", record["GoalName"].ToString());
                    item.Attributes.Add("WeeklyGoal", goalDescription.ToString());
                    item.Attributes.Add("Task1", "1. " + step1);
                    item.Attributes.Add("Task2", "2. " + step2);
                    item.Attributes.Add("Task3", "3. " + step3);
                    item.Attributes.Add("Task4", "4. " + step4);
                    item.Attributes.Add("Task5", "5. " + step5);
                    item.Attributes.Add("Task6", "6. " + step6);
                    item.Attributes.Add("Task7", "7. " + step7);
                    item.Attributes.Add("Task8", "8. " + step8);
                    item.Attributes.Add("Task9", "9. " + step9);
                    item.Attributes.Add("Task10", "10. " + step10);
                    item.Attributes.Add("T1EstimatedHours", step1Hours.ToString());
                    item.Attributes.Add("T2EstimatedHours", step2Hours.ToString());
                    item.Attributes.Add("T3EstimatedHours", step3Hours.ToString());
                    item.Attributes.Add("T4EstimatedHours", step4Hours.ToString());
                    item.Attributes.Add("T5EstimatedHours", step5Hours.ToString());
                    item.Attributes.Add("T6EstimatedHours", step6Hours.ToString());
                    item.Attributes.Add("T7EstimatedHours", step7Hours.ToString());
                    item.Attributes.Add("T8EstimatedHours", step8Hours.ToString());
                    item.Attributes.Add("T9EstimatedHours", step9Hours.ToString());
                    item.Attributes.Add("T10EstimatedHours", step10Hours.ToString());
 
                    IncompleteGoalsDropDown.Items.Add(item);
                    item.DataBind();
                }
 
                cmd2.Connection.Close();
                cmd2.Connection.Dispose();
            }
 
            if (e.Item is GridEditFormInsertItem)
            {
                //GridEditFormInsertItem editInsertForm = (GridEditFormInsertItem)e.Item;
                RadDatePicker beginDatePicker = (RadDatePicker)e.Item.FindControl("beginDatePicker");
                RadDatePicker endDatePicker = (RadDatePicker)e.Item.FindControl("endDatePicker");
 
                if (Session["beginDate"] != null && Session["endDate"] != null)
                {
                    beginDatePicker.DbSelectedDate = Session["beginDate"].ToString();
                    endDatePicker.DbSelectedDate = Session["endDate"].ToString();
                }
            }
            //This insures that the first group of goals is always shown to the user.
            if (e.Item is GridGroupHeaderItem)
            {
                GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
                if (item.GroupIndex == "0")
                    item.Expanded = true;
            }
             
                         
            //This is where we grab the aggregate for the Total Goal Hours
            if (e.Item is GridFooterItem)
            {
                //GridFooterItem footer = (GridFooterItem)e.Item;
                //string strtxt = footer["TotalGoalHours"].Text;
                //string[] arr = strtxt.Split(':');
                //string count = arr[1].ToString();
            }
        }
        protected void searchButton_Click(object sender, EventArgs e)
        {
            try
            {
                RadButton searchButton = (RadButton)sender;
                GridEditFormItem editItem = (GridEditFormItem)searchButton.NamingContainer;
                RadComboBox divisionGoalsComboBox = (RadComboBox)editItem.FindControl("divisionGoalsComboBox");
                RadTextBox keywordsTextBox = (RadTextBox)editItem.FindControl("keywordsTextBox");
                string keywordString = keywordsTextBox.Text.ToString();
 
                if (string.IsNullOrEmpty(keywordString))
                {
                    Label noCriteriaLabel = new Label();
                    noCriteriaLabel.Text = "Please enter search criteria.";
                    resultsPanel.Controls.Add(noCriteriaLabel);
                }
                else
                {
                    string[] keywords = keywordString.Split(',');
 
                    foreach (string keyword in keywords)
                    {
                        try
                        {
                            //DataTable dt = new DataTable();
                            SqlConnection connection = new SqlConnection(GetConnectionString());
 
                            connection.Open();
                            SqlCommand cmd = new SqlCommand("SearchWeeklyGoals", connection);
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.AddWithValue("@Keywords", keyword);
                            cmd.Parameters.AddWithValue("@UserName", GoalSlayer.ActiveDirectoryUser.UserName(User));
                            SqlDataReader dr;
 
                            dr = cmd.ExecuteReader();
 
                            foreach (IDataRecord record in dr)
                            {
                                RadComboBoxItem item = new RadComboBoxItem();
 
                                item.Text = "Goal Name" + (string)record["GoalName"];
                                item.Value = record["GoalID"].ToString();
 
                                string goalDescription = record["WeeklyGoal"].ToString();
                                string step1 = record["Task1"].ToString();
                                string step2 = record["Task2"].ToString();
                                string step3 = record["Task3"].ToString();
                                string step4 = record["Task4"].ToString();
                                string step5 = record["Task5"].ToString();
                                string step6 = record["Task6"].ToString();
                                string step7 = record["Task7"].ToString();
                                string step8 = record["Task8"].ToString();
                                string step9 = record["Task9"].ToString();
                                string step10 = record["Task10"].ToString();
                                string step1Hours = record["T1EstimatedHours"].ToString();
                                string step2Hours = record["T2EstimatedHours"].ToString();
                                string step3Hours = record["T3EstimatedHours"].ToString();
                                string step4Hours = record["T4EstimatedHours"].ToString();
                                string step5Hours = record["T5EstimatedHours"].ToString();
                                string step6Hours = record["T6EstimatedHours"].ToString();
                                string step7Hours = record["T7EstimatedHours"].ToString();
                                string step8Hours = record["T8EstimatedHours"].ToString();
                                string step9Hours = record["T9EstimatedHours"].ToString();
                                string step10Hours = record["T10EstimatedHours"].ToString();
 
                                item.Attributes.Add("GoalName", record["GoalName"].ToString());
                                item.Attributes.Add("WeeklyGoal", goalDescription.ToString());
                                item.Attributes.Add("Task1", "1. " + step1);
                                item.Attributes.Add("Task2", "2. " + step2);
                                item.Attributes.Add("Task3", "3. " + step3);
                                item.Attributes.Add("Task4", "4. " + step4);
                                item.Attributes.Add("Task5", "5. " + step5);
                                item.Attributes.Add("Task6", "6. " + step6);
                                item.Attributes.Add("Task7", "7. " + step7);
                                item.Attributes.Add("Task8", "8. " + step8);
                                item.Attributes.Add("Task9", "9. " + step9);
                                item.Attributes.Add("Task10", "10. " + step10);
                                item.Attributes.Add("T1EstimatedHours", step1Hours.ToString());
                                item.Attributes.Add("T2EstimatedHours", step2Hours.ToString());
                                item.Attributes.Add("T3EstimatedHours", step3Hours.ToString());
                                item.Attributes.Add("T4EstimatedHours", step4Hours.ToString());
                                item.Attributes.Add("T5EstimatedHours", step5Hours.ToString());
                                item.Attributes.Add("T6EstimatedHours", step6Hours.ToString());
                                item.Attributes.Add("T7EstimatedHours", step7Hours.ToString());
                                item.Attributes.Add("T8EstimatedHours", step8Hours.ToString());
                                item.Attributes.Add("T9EstimatedHours", step9Hours.ToString());
                                item.Attributes.Add("T10EstimatedHours", step10Hours.ToString());
 
                                divisionGoalsComboBox.Items.Add(item);
                                item.DataBind();
                            }
 
                            connection.Close();
                            connection.Dispose();
 
                            divisionGoalsComboBox.OpenDropDownOnLoad = true;
                        }
                        catch (System.Data.SqlClient.SqlException ex)
                        {
                            string msg = "Fetch Error:";
                            msg += ex.Message;
                            throw new Exception(msg);
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                string msg = "Fetch Error:";
                msg += exc.Message;
                throw new Exception(msg);
            }
        }
        protected void openSearchWindowButton_Click(object sender, EventArgs e)
        {
            RadNotification1.Show();
        }
 
        protected void divisionGoalsComboBox_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            RadComboBox divisionGoalsComboBox = (RadComboBox)sender;
            divisionGoalsComboBox.OpenDropDownOnLoad = false;
        }
 
        protected void divisionGoalsComboBox_ItemCreated(object sender, RadComboBoxItemEventArgs e)
        {
            RadComboBox divisionGoalsComboBox = (RadComboBox)sender;
            divisionGoalsComboBox.OpenDropDownOnLoad = false;
        }
 
        protected void divisionGoalsComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadComboBox divisionGoalsDropDown = (RadComboBox)sender;
 
            if (divisionGoalsDropDown.SelectedIndex >= 0)
            {
                string goalID = divisionGoalsDropDown.SelectedItem.Value.ToString();
 
                DataTable dt = new DataTable();
                SqlConnection connection = new SqlConnection(GetConnectionString());
                try
                {
                    connection.Open();
                    SqlCommand cmd = new SqlCommand("RetrieveWeeklyGoal", connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@GoalID", goalID);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
 
                    da.Fill(dt);
                    if (dt.Rows.Count >= 0)  //the greater than or equal to is necessary to delete the last row in the gridview.
                    {
                        System.Collections.Specialized.ListDictionary templateValues = new System.Collections.Specialized.ListDictionary();
 
                        templateValues["goalNameTextBox"] = dt.Rows[0]["GoalName"].ToString();
                        templateValues["goalDescriptionTextBox"] = dt.Rows[0]["WeeklyGoal"].ToString();
                        templateValues["step1TextBox"] = dt.Rows[0]["Task1"].ToString();
                        templateValues["step2TextBox"] = dt.Rows[0]["Task2"].ToString();
                        templateValues["step3TextBox"] = dt.Rows[0]["Task3"].ToString();
                        templateValues["step4TextBox"] = dt.Rows[0]["Task4"].ToString();
                        templateValues["step5TextBox"] = dt.Rows[0]["Task5"].ToString();
                        templateValues["step6TextBox"] = dt.Rows[0]["Task6"].ToString();
                        templateValues["step7TextBox"] = dt.Rows[0]["Task7"].ToString();
                        templateValues["step8TextBox"] = dt.Rows[0]["Task8"].ToString();
                        templateValues["step9TextBox"] = dt.Rows[0]["Task9"].ToString();
                        templateValues["step10TextBox"] = dt.Rows[0]["Task10"].ToString();
 
                        GridEditFormItem editItem = (GridEditFormItem)divisionGoalsDropDown.NamingContainer;
                        RadTextBox goalNameTextBox = (RadTextBox)editItem.FindControl("goalNameTextBox");
                        RadTextBox goalDescriptionTextBox = (RadTextBox)editItem.FindControl("goalDescriptionTextBox");
                        RadTextBox step1TextBox = (RadTextBox)editItem.FindControl("step1TextBox");
                        RadTextBox step2TextBox = (RadTextBox)editItem.FindControl("step2TextBox");
                        RadTextBox step3TextBox = (RadTextBox)editItem.FindControl("step3TextBox");
                        RadTextBox step4TextBox = (RadTextBox)editItem.FindControl("step4TextBox");
                        RadTextBox step5TextBox = (RadTextBox)editItem.FindControl("step5TextBox");
                        RadTextBox step6TextBox = (RadTextBox)editItem.FindControl("step6TextBox");
                        RadTextBox step7TextBox = (RadTextBox)editItem.FindControl("step7TextBox");
                        RadTextBox step8TextBox = (RadTextBox)editItem.FindControl("step8TextBox");
                        RadTextBox step9TextBox = (RadTextBox)editItem.FindControl("step9TextBox");
                        RadTextBox step10TextBox = (RadTextBox)editItem.FindControl("step10TextBox");
 
                        RadNumericTextBox step1TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step1TextBox_hrs");
                        RadNumericTextBox step2TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step2TextBox_hrs");
                        RadNumericTextBox step3TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step3TextBox_hrs");
                        RadNumericTextBox step4TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step4TextBox_hrs");
                        RadNumericTextBox step5TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step5TextBox_hrs");
                        RadNumericTextBox step6TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step6TextBox_hrs");
                        RadNumericTextBox step7TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step7TextBox_hrs");
                        RadNumericTextBox step8TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step8TextBox_hrs");
                        RadNumericTextBox step9TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step9TextBox_hrs");
                        RadNumericTextBox step10TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step10TextBox_hrs");
 
                        goalNameTextBox.Text = dt.Rows[0]["GoalName"].ToString();
                        goalDescriptionTextBox.Text = dt.Rows[0]["WeeklyGoal"].ToString();
                        step1TextBox.Text = dt.Rows[0]["Task1"].ToString();
                        step2TextBox.Text = dt.Rows[0]["Task2"].ToString();
                        step3TextBox.Text = dt.Rows[0]["Task3"].ToString();
                        step4TextBox.Text = dt.Rows[0]["Task4"].ToString();
                        step5TextBox.Text = dt.Rows[0]["Task5"].ToString();
                        step6TextBox.Text = dt.Rows[0]["Task6"].ToString();
                        step7TextBox.Text = dt.Rows[0]["Task7"].ToString();
                        step8TextBox.Text = dt.Rows[0]["Task8"].ToString();
                        step9TextBox.Text = dt.Rows[0]["Task9"].ToString();
                        step10TextBox.Text = dt.Rows[0]["Task10"].ToString();
 
                        step1TextBox_hrs.Text = dt.Rows[0]["T1EstimatedHours"].ToString();
                        step2TextBox_hrs.Text = dt.Rows[0]["T2EstimatedHours"].ToString();
                        step3TextBox_hrs.Text = dt.Rows[0]["T3EstimatedHours"].ToString();
                        step4TextBox_hrs.Text = dt.Rows[0]["T4EstimatedHours"].ToString();
                        step5TextBox_hrs.Text = dt.Rows[0]["T5EstimatedHours"].ToString();
                        step6TextBox_hrs.Text = dt.Rows[0]["T6EstimatedHours"].ToString();
                        step7TextBox_hrs.Text = dt.Rows[0]["T7EstimatedHours"].ToString();
                        step8TextBox_hrs.Text = dt.Rows[0]["T8EstimatedHours"].ToString();
                        step9TextBox_hrs.Text = dt.Rows[0]["T9EstimatedHours"].ToString();
                        step10TextBox_hrs.Text = dt.Rows[0]["T10EstimatedHours"].ToString();
                    }
                }
                catch (System.Data.SqlClient.SqlException ex)
                {
                    string msg = "Fetch Error:";
                    msg += ex.Message;
                    throw new Exception(msg);
                }
                finally
                {
                    connection.Close();
                    connection.Dispose();
                }
            }
        }
 
        protected void beginDatePicker_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e)
        {
            RadDatePicker beginDatePicker = (RadDatePicker)sender;
 
            GridEditFormItem editItem = (GridEditFormItem)beginDatePicker.NamingContainer;
 
            RadDatePicker endDatePicker = (RadDatePicker)editItem.FindControl("endDatePicker");
            endDatePicker.DbSelectedDate = (e.NewDate.Value.AddDays(4));
 
            Session["beginDate"] = e.NewDate.Value.ToShortDateString();
            Session["endDate"] = ((DateTime)endDatePicker.DbSelectedDate).ToShortDateString();
        }
 
        protected void ValidateStepTextBox(object sender, ServerValidateEventArgs args)
        {
            GoalSlayer.valueChecker value = new GoalSlayer.valueChecker();
 
            string valCntrlID = ((Control)sender).ID;
            string hrsCntrlID = valCntrlID.Remove(valCntrlID.Length - 3) + "hrs";
            string tskCntrlID = valCntrlID.Remove(valCntrlID.Length - 4);
            string chkCntrlID = valCntrlID.Remove(valCntrlID.Length - 3) + "chk";
 
            string hrsCntrlValue = ((RadNumericTextBox)((Control)sender).NamingContainer.FindControl(hrsCntrlID)).Text;
            string tskCntrlValue = ((RadTextBox)((Control)sender).NamingContainer.FindControl(tskCntrlID)).Text;
 
            if (!value.isZeroOrNull(hrsCntrlValue) && string.IsNullOrEmpty(tskCntrlValue))
            {
                ((RadTextBox)((Control)sender).NamingContainer.FindControl(tskCntrlID)).CssClass = "error";
                ((CustomValidator)((Control)sender).NamingContainer.FindControl(valCntrlID)).ErrorMessage = "Cannot insert hours without a step.";
                args.IsValid = false;
            }
            else if (value.isZeroOrNull(hrsCntrlValue) && string.IsNullOrEmpty(tskCntrlValue))
            {
                ((CheckBox)((Control)sender).NamingContainer.FindControl(chkCntrlID)).Checked = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
 
        protected void showHelpWindowButton_Click(object sender, EventArgs e)
        {
            helpWindow.Visible = true;
        }
 
        protected void IncompleteGoalsDropDown_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
            RadComboBox IncompleteGoalsDropDown = (RadComboBox)sender;
 
            if (IncompleteGoalsDropDown.SelectedIndex >= 0)
            {
                string goalID = IncompleteGoalsDropDown.SelectedItem.Value.ToString();
 
                DataTable dt = new DataTable();
                SqlConnection connection = new SqlConnection(GetConnectionString());
                try
                {
                    connection.Open();
                    SqlCommand cmd = new SqlCommand("RetrieveWeeklyGoal", connection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@GoalID", goalID);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
 
                    da.Fill(dt);
                    if (dt.Rows.Count >= 0)  //the greater than or equal to is necessary to delete the last row in the gridview.
                    {
                        System.Collections.Specialized.ListDictionary templateValues = new System.Collections.Specialized.ListDictionary();
 
                        templateValues["goalNameTextBox"] = dt.Rows[0]["GoalName"].ToString();
                        templateValues["goalDescriptionTextBox"] = dt.Rows[0]["WeeklyGoal"].ToString();
                        templateValues["step1TextBox"] = dt.Rows[0]["Task1"].ToString();
                        templateValues["step2TextBox"] = dt.Rows[0]["Task2"].ToString();
                        templateValues["step3TextBox"] = dt.Rows[0]["Task3"].ToString();
                        templateValues["step4TextBox"] = dt.Rows[0]["Task4"].ToString();
                        templateValues["step5TextBox"] = dt.Rows[0]["Task5"].ToString();
                        templateValues["step6TextBox"] = dt.Rows[0]["Task6"].ToString();
                        templateValues["step7TextBox"] = dt.Rows[0]["Task7"].ToString();
                        templateValues["step8TextBox"] = dt.Rows[0]["Task8"].ToString();
                        templateValues["step9TextBox"] = dt.Rows[0]["Task9"].ToString();
                        templateValues["step10TextBox"] = dt.Rows[0]["Task10"].ToString();
 
                        GridEditFormItem editItem = (GridEditFormItem)IncompleteGoalsDropDown.NamingContainer;
                        RadTextBox goalNameTextBox = (RadTextBox)editItem.FindControl("goalNameTextBox");
                        RadTextBox goalDescriptionTextBox = (RadTextBox)editItem.FindControl("goalDescriptionTextBox");
                        RadTextBox step1TextBox = (RadTextBox)editItem.FindControl("step1TextBox");
                        RadTextBox step2TextBox = (RadTextBox)editItem.FindControl("step2TextBox");
                        RadTextBox step3TextBox = (RadTextBox)editItem.FindControl("step3TextBox");
                        RadTextBox step4TextBox = (RadTextBox)editItem.FindControl("step4TextBox");
                        RadTextBox step5TextBox = (RadTextBox)editItem.FindControl("step5TextBox");
                        RadTextBox step6TextBox = (RadTextBox)editItem.FindControl("step6TextBox");
                        RadTextBox step7TextBox = (RadTextBox)editItem.FindControl("step7TextBox");
                        RadTextBox step8TextBox = (RadTextBox)editItem.FindControl("step8TextBox");
                        RadTextBox step9TextBox = (RadTextBox)editItem.FindControl("step9TextBox");
                        RadTextBox step10TextBox = (RadTextBox)editItem.FindControl("step10TextBox");
 
                        RadNumericTextBox step1TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step1TextBox_hrs");
                        RadNumericTextBox step2TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step2TextBox_hrs");
                        RadNumericTextBox step3TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step3TextBox_hrs");
                        RadNumericTextBox step4TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step4TextBox_hrs");
                        RadNumericTextBox step5TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step5TextBox_hrs");
                        RadNumericTextBox step6TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step6TextBox_hrs");
                        RadNumericTextBox step7TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step7TextBox_hrs");
                        RadNumericTextBox step8TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step8TextBox_hrs");
                        RadNumericTextBox step9TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step9TextBox_hrs");
                        RadNumericTextBox step10TextBox_hrs = (RadNumericTextBox)editItem.FindControl("step10TextBox_hrs");
 
                        goalNameTextBox.Text = dt.Rows[0]["GoalName"].ToString();
                        goalDescriptionTextBox.Text = dt.Rows[0]["WeeklyGoal"].ToString();
                        step1TextBox.Text = dt.Rows[0]["Task1"].ToString();
                        step2TextBox.Text = dt.Rows[0]["Task2"].ToString();
                        step3TextBox.Text = dt.Rows[0]["Task3"].ToString();
                        step4TextBox.Text = dt.Rows[0]["Task4"].ToString();
                        step5TextBox.Text = dt.Rows[0]["Task5"].ToString();
                        step6TextBox.Text = dt.Rows[0]["Task6"].ToString();
                        step7TextBox.Text = dt.Rows[0]["Task7"].ToString();
                        step8TextBox.Text = dt.Rows[0]["Task8"].ToString();
                        step9TextBox.Text = dt.Rows[0]["Task9"].ToString();
                        step10TextBox.Text = dt.Rows[0]["Task10"].ToString();
 
                        step1TextBox_hrs.Text = dt.Rows[0]["T1EstimatedHours"].ToString();
                        step2TextBox_hrs.Text = dt.Rows[0]["T2EstimatedHours"].ToString();
                        step3TextBox_hrs.Text = dt.Rows[0]["T3EstimatedHours"].ToString();
                        step4TextBox_hrs.Text = dt.Rows[0]["T4EstimatedHours"].ToString();
                        step5TextBox_hrs.Text = dt.Rows[0]["T5EstimatedHours"].ToString();
                        step6TextBox_hrs.Text = dt.Rows[0]["T6EstimatedHours"].ToString();
                        step7TextBox_hrs.Text = dt.Rows[0]["T7EstimatedHours"].ToString();
                        step8TextBox_hrs.Text = dt.Rows[0]["T8EstimatedHours"].ToString();
                        step9TextBox_hrs.Text = dt.Rows[0]["T9EstimatedHours"].ToString();
                        step10TextBox_hrs.Text = dt.Rows[0]["T10EstimatedHours"].ToString();
                    }
                }
                catch (System.Data.SqlClient.SqlException ex)
                {
                    string msg = "Fetch Error:";
                    msg += ex.Message;
                    throw new Exception(msg);
                }
                finally
                {
                    connection.Close();
                    connection.Dispose();
                }
            }
        }
 
        protected void GoalCompleteCheckedChanged(object sender, System.EventArgs e)
        {
            CheckBox chkBox = (sender as CheckBox);
 
            //find the City field in the row and change its color
 
            //first reference the panel which wraps the checkbox control through the Parent property
            Panel myPanel = chkBox.Parent as Panel;
 
            //then fetch the grid data item through the NamingContainer attribute of the container control (panel in this case)
            GridDataItem dataItem = myPanel.NamingContainer as GridDataItem;
 
            //finally assign a CSS class to the table cell depending on the item type (item, alternatingItem)
            if (chkBox.Checked)
            {
                 
            }
            else
            {
                 
            }
 
            if (sender is CheckBox)
            {
 
            }
        }
 
    }
}

0
pmourfield
Top achievements
Rank 1
answered on 16 Apr 2012, 03:10 PM
I figured it out. Apparently setting the index of the page causes the grid not to show up correctly. Not sure what's going on yet, but I'll see if I can find out why this block of code:
//need to reset the current page index back to 1 each time given that new records are in decending order.
            RadGrid1.CurrentPageIndex = '1';

is causing the problem.
Tags
Grid
Asked by
pmourfield
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
pmourfield
Top achievements
Rank 1
Share this question
or