Link to home
Start Free TrialLog in
Avatar of David Megnin
David MegninFlag for United States of America

asked on

Select and Edit don't work in GridView.

I have a Gridview on an ASP.Net page with several other GVs.  The others work fine, but one of them has suddenly decided that it doesn't want to let me select or edit a row.  This GV is like a "detail" of the selected row of the GV above it, but that's not important.  The one above it works fine.  I select a row and then this one gets populated with the associated data which may be several rows.  But, when I click Select or Edit, nothing happens.  If I click Delete, the row is deleted.

What could I be missing?

I thought that perhaps this SELECT query in SqlDataSource3 was causing a problem (I don't know):
SELECT   keyJobTitleID,
         JobTitle,
         ISNULL(cbWeekdays,'False')                AS cbWeekdays,
         ISNULL(cbSaturdays,'False')               AS cbSaturdays,
         ISNULL(cbSundays,'False')                 AS cbSundays,
         ddlBackgroundCheck,
         JobDescription,
         ddlStartTime,
         ddlEndTime,
         ISNULL(cbMonday,'False')                  AS cbMonday,
         ISNULL(cbTuesday,'False')                 AS cbTuesday,
         ISNULL(cbWednesday,'False')               AS cbWednesday,
         ISNULL(cbThursday,'False')                AS cbThursday,
         ISNULL(cbFriday,'False')                  AS cbFriday,
         ISNULL(cbHSDiploma,'False')               AS cbHSDiploma,
         ISNULL(cbVocationalTraining,'False')      AS cbVocationalTraining,
         ISNULL(cbCollegeDegree,'False')           AS cbCollegeDegree,
         ISNULL(cbNoEdRequirement,'False')         AS cbNoEdRequirement,
         ISNULL(cbWindows,'False')                 AS cbWindows,
         ISNULL(cbMAC,'False')                     AS cbMAC,
         ISNULL(cbLinux,'False')                   AS cbLinux,
         ISNULL(cbNoOSRequirement,'False')         AS cbNoOSRequirement,
         ISNULL(cbMSWord,'False')                  AS cbMSWord,
         ISNULL(cbMSExcel,'False')                 AS cbMSExcel,
         ISNULL(cbMSPowerPoint,'False')            AS cbMSPowerPoint,
         ISNULL(cbMSAccess,'False')                AS cbMSAccess,
         ISNULL(cbMSPublisher,'False')             AS cbMSPublisher,
         ISNULL(cbOtherSoftware,'False')           AS cbOtherSoftware,
         txtOtherSoftware,
         ISNULL(cbNoSoftwareRequirement,'False')   AS cbNoSoftwareRequirement,
         txtTypeWPM,
         txtRequirementsComments,
         radAcceptCriminalBG,
         ISNULL(cbFingerprinting,'False')          AS cbFingerprinting,
         ISNULL(cbDrugScreening,'False')           AS cbDrugScreening,
         ISNULL(cbBilingual,'False')               AS cbBilingual,
         ISNULL(cbEnglishSpanish,'False')          AS cbEnglishSpanish,
         ISNULL(cbEnglishCreole,'False')           AS cbEnglishCreole,
         ISNULL(cbMedicalTesting,'False')          AS cbMedicalTesting,
         ISNULL(cbPrePlacementOrientation,'False') AS cbPrePlacementOrientation,
         radPotentialEmployment,
         radInterviewCandidate,
         txtRequestedSkills
FROM     JobTitles
WHERE    (keyWorksiteID = @keyWorksiteID)
ORDER BY keyJobTitleID

So I tried changing it to:
SELECT *
FROM     JobTitles
WHERE    (keyWorksiteID = @keyWorksiteID)
ORDER BY keyJobTitleID

Of course that didn't make any difference.  It had been working just fine before.
<asp:GridView ID="gvJobTitles" runat="server" AllowSorting="True" 
        AutoGenerateColumns="False" 
        Caption="Job Titles at selected Worksite:" CssClass="Grid" DataKeyNames="keyJobTitleID" 
        DataSourceID="SqlDataSource3" Visible="False">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" UpdateText="Save" ShowEditButton="True" ShowSelectButton="True" />
            <asp:BoundField DataField="keyJobTitleID" HeaderText="JobTitle ID" InsertVisible="False" ReadOnly="True" SortExpression="keyJobTitleID">
            <ItemStyle Wrap="False" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Job Title" SortExpression="JobTitle">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlJobTitle" runat="server" 
                        DataTextField="JobTitle" DataValueField="JobTitle" 
                        SelectedValue='<%# Bind("JobTitle") %>'>
                                     	  <asp:ListItem Value="0">Select One...</asp:ListItem>
    									  <asp:ListItem Value="Office  Data Entry" Text="Office  Data Entry" />
    									  <asp:ListItem Value="Office  Receptionist" Text="Office  Receptionist" />
    									  <asp:ListItem Value="Office  Customer Service" Text="Office  Customer Service" />
    									  <asp:ListItem Value="Office  Multi-functional Admin" Text="Office  Multi-functional Admin" />
    									  <asp:ListItem Value="Warehouse" Text="Warehouse" />
    									  <asp:ListItem Value="Childcare" Text="Childcare" />
    									  <asp:ListItem Value="Food Service" Text="Food Service" />
    									  <asp:ListItem Value="Healthcare" Text="Healthcare" />
    									  <asp:ListItem Value="Retail" Text="Retail" />
    									  <asp:ListItem Value="Education" Text="Education" />
    									  <asp:ListItem Value="Other" Text="Other" />
                    </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("JobTitle") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Start Time" SortExpression="ddlStartTime">
                <EditItemTemplate>
            <asp:DropDownList ID="ddlStartTime" runat="server" 
                SelectedValue='<%# Bind("ddlStartTime") %>'>
                <asp:ListItem Text="0:00 AM" Value="0:00 AM"></asp:ListItem>
                <asp:ListItem Text="0:30 AM"></asp:ListItem>
                <asp:ListItem Text="1:00 AM"></asp:ListItem>
                <asp:ListItem Text="1:30 AM"></asp:ListItem>
                <asp:ListItem Text="2:00 AM"></asp:ListItem>
                <asp:ListItem Text="2:30 AM"></asp:ListItem>
                <asp:ListItem Text="3:00 AM"></asp:ListItem>
                <asp:ListItem Text="3:30 AM"></asp:ListItem>
                <asp:ListItem Text="4:00 AM"></asp:ListItem>
                <asp:ListItem Text="4:30 AM"></asp:ListItem>
                <asp:ListItem Text="5:00 AM"></asp:ListItem>
                <asp:ListItem Text="5:30 AM"></asp:ListItem>
                <asp:ListItem Text="6:00 AM"></asp:ListItem>
                <asp:ListItem Text="6:30 AM"></asp:ListItem>
                <asp:ListItem Text="7:00 AM"></asp:ListItem>
                <asp:ListItem Text="7:30 AM"></asp:ListItem>
                <asp:ListItem Text="8:00 AM" Selected="True" Value="8:00 AM"></asp:ListItem>
                <asp:ListItem Text="8:30 AM"></asp:ListItem>
                <asp:ListItem Text="9:00 AM"></asp:ListItem>
                <asp:ListItem Text="9:30 AM"></asp:ListItem>
                <asp:ListItem Text="10:00 AM"></asp:ListItem>
                <asp:ListItem Text="10:30 AM"></asp:ListItem>
                <asp:ListItem Text="11:00 AM"></asp:ListItem>
                <asp:ListItem Text="11:30 AM"></asp:ListItem>
                <asp:ListItem Text="12:00 PM"></asp:ListItem>
                <asp:ListItem Text="12:30 PM"></asp:ListItem>
                <asp:ListItem Text="1:00 PM"></asp:ListItem>
                <asp:ListItem Text="1:30 PM"></asp:ListItem>
                <asp:ListItem Text="2:00 PM"></asp:ListItem>
                <asp:ListItem Text="2:30 PM"></asp:ListItem>
                <asp:ListItem Text="3:00 PM"></asp:ListItem>
                <asp:ListItem Text="3:30 PM"></asp:ListItem>
                <asp:ListItem Text="4:00 PM"></asp:ListItem>
                <asp:ListItem Text="4:30 PM"></asp:ListItem>
                <asp:ListItem Text="5:00 PM"></asp:ListItem>
                <asp:ListItem Text="5:30 PM"></asp:ListItem>
                <asp:ListItem Text="6:00 PM"></asp:ListItem>
                <asp:ListItem Text="6:30 PM"></asp:ListItem>
                <asp:ListItem Text="7:00 PM"></asp:ListItem>
                <asp:ListItem Text="7:30 PM"></asp:ListItem>
                <asp:ListItem Text="8:00 PM"></asp:ListItem>
                <asp:ListItem Text="8:30 PM"></asp:ListItem>
                <asp:ListItem Text="9:00 PM"></asp:ListItem>
                <asp:ListItem Text="9:30 PM"></asp:ListItem>
                <asp:ListItem Text="10:00 PM"></asp:ListItem>
                <asp:ListItem Text="10:30 PM"></asp:ListItem>
                <asp:ListItem Text="11:00 PM"></asp:ListItem>
                <asp:ListItem Text="11:30 PM"></asp:ListItem>
                <asp:ListItem Text="11:59 PM"></asp:ListItem>
            </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblStartTime" runat="server" Text='<%# Bind("ddlStartTime") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="End Time" SortExpression="ddlEndTime">
                <EditItemTemplate>
            <asp:DropDownList ID="ddlEndTime" runat="server" 
                SelectedValue='<%# Bind("ddlEndTime") %>'>
                <asp:ListItem Text="0:00 AM"></asp:ListItem>
                <asp:ListItem Text="0:30 AM"></asp:ListItem>
                <asp:ListItem Text="1:00 AM" Value="1:00 AM"></asp:ListItem>
                <asp:ListItem Text="1:30 AM"></asp:ListItem>
                <asp:ListItem Text="2:00 AM"></asp:ListItem>
                <asp:ListItem Text="2:30 AM"></asp:ListItem>
                <asp:ListItem Text="3:00 AM"></asp:ListItem>
                <asp:ListItem Text="3:30 AM"></asp:ListItem>
                <asp:ListItem Text="4:00 AM"></asp:ListItem>
                <asp:ListItem Text="4:30 AM"></asp:ListItem>
                <asp:ListItem Text="5:00 AM"></asp:ListItem>
                <asp:ListItem Text="5:30 AM"></asp:ListItem>
                <asp:ListItem Text="6:00 AM"></asp:ListItem>
                <asp:ListItem Text="6:30 AM"></asp:ListItem>
                <asp:ListItem Text="7:00 AM"></asp:ListItem>
                <asp:ListItem Text="7:30 AM"></asp:ListItem>
                <asp:ListItem Text="8:00 AM"></asp:ListItem>
                <asp:ListItem Text="8:30 AM"></asp:ListItem>
                <asp:ListItem Text="9:00 AM"></asp:ListItem>
                <asp:ListItem Text="9:30 AM"></asp:ListItem>
                <asp:ListItem Text="10:00 AM"></asp:ListItem>
                <asp:ListItem Text="10:30 AM"></asp:ListItem>
                <asp:ListItem Text="11:00 AM"></asp:ListItem>
                <asp:ListItem Text="11:30 AM"></asp:ListItem>
                <asp:ListItem Text="12:00 PM" Selected="True" Value="12:00 PM"></asp:ListItem>
                <asp:ListItem Text="12:30 PM"></asp:ListItem>
                <asp:ListItem Text="1:00 PM"></asp:ListItem>
                <asp:ListItem Text="1:30 PM"></asp:ListItem>
                <asp:ListItem Text="2:00 PM"></asp:ListItem>
                <asp:ListItem Text="2:30 PM"></asp:ListItem>
                <asp:ListItem Text="3:00 PM"></asp:ListItem>
                <asp:ListItem Text="3:30 PM"></asp:ListItem>
                <asp:ListItem Text="4:00 PM"></asp:ListItem>
                <asp:ListItem Text="4:30 PM"></asp:ListItem>
                <asp:ListItem Text="5:00 PM"></asp:ListItem>
                <asp:ListItem Text="5:30 PM"></asp:ListItem>
                <asp:ListItem Text="6:00 PM"></asp:ListItem>
                <asp:ListItem Text="6:30 PM"></asp:ListItem>
                <asp:ListItem Text="7:00 PM"></asp:ListItem>
                <asp:ListItem Text="7:30 PM"></asp:ListItem>
                <asp:ListItem Text="8:00 PM"></asp:ListItem>
                <asp:ListItem Text="8:30 PM"></asp:ListItem>
                <asp:ListItem Text="9:00 PM"></asp:ListItem>
                <asp:ListItem Text="9:30 PM"></asp:ListItem>
                <asp:ListItem Text="10:00 PM"></asp:ListItem>
                <asp:ListItem Text="10:30 PM"></asp:ListItem>
                <asp:ListItem Text="11:00 PM"></asp:ListItem>
                <asp:ListItem Text="11:30 PM"></asp:ListItem>
                <asp:ListItem Text="11:59 PM"></asp:ListItem>
            </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblEndTime" runat="server" Text='<%# Bind("ddlEndTime") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="M-F" ItemStyle-CssClass="centered" SortExpression="cbWeekdays" HeaderStyle-Wrap="False">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbWeekdays" runat="server" Checked='<%# Bind("cbWeekdays") %>' name="Check1" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbWeekdays" runat="server" Checked='<%# Eval("cbWeekdays") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <HeaderStyle Wrap="False" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Mon" ItemStyle-CssClass="centered" SortExpression="cbMonday">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMonday" runat="server" Checked='<%# Bind("cbMonday") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMonday" runat="server" Checked='<%# Eval("cbMonday") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tues" ItemStyle-CssClass="centered" SortExpression="cbTuesday">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbTuesday" runat="server" Checked='<%# Bind("cbTuesday") %>' name="Check5" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbTuesday" runat="server" Checked='<%# Eval("cbTuesday") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
 
            <asp:TemplateField HeaderText="Wed" ItemStyle-CssClass="centered" SortExpression="cbWednesday">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbWednesday" runat="server" Checked='<%# Bind("cbWednesday") %>' name="Check6" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbWednesday" runat="server" Checked='<%# Eval("cbWednesday") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
 
            <asp:TemplateField HeaderText="Thur" ItemStyle-CssClass="centered" SortExpression="cbThursday">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbThursday" runat="server" Checked='<%# Bind("cbThursday") %>' name="Check7" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbThursday" runat="server" Checked='<%# Eval("cbThursday") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
 
            <asp:TemplateField HeaderText="Fri" ItemStyle-CssClass="centered" SortExpression="cbFriday">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbFriday" runat="server" Checked='<%# Bind("cbFriday") %>' name="Check8" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbFriday" runat="server" Checked='<%# Eval("cbFriday") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Sat" ItemStyle-CssClass="centered" SortExpression="cbSaturdays">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbSaturdays" runat="server" Checked='<%# Bind("cbSaturdays") %>' name="Check2" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbSaturdays" runat="server" Checked='<%# Eval("cbSaturdays") %>' Enabled="false" />
                </ItemTemplate>
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Sun" ItemStyle-CssClass="centered" SortExpression="cbSundays">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbSundays" runat="server" Checked='<%# Bind("cbSundays") %>' name="Check3" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbSundays" runat="server" Checked='<%# Eval("cbSundays") %>' Enabled="false" />
                </ItemTemplate>
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
            <asp:BoundField DataField="JobDescription" HeaderText="Job Description" SortExpression="JobDescription" ItemStyle-HorizontalAlign="Left">
				<ItemStyle Wrap="False"/>
            </asp:BoundField>
 
            <asp:BoundField DataField="txtRequestedSkills" HeaderText="Skills participants will obtain" SortExpression="txtRequestedSkills">
            <ItemStyle Wrap="False" />
            </asp:BoundField>
 
            <asp:TemplateField HeaderText="cbHSDiploma" ItemStyle-CssClass="centered" SortExpression="cbHSDiploma">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbHSDiploma" runat="server" Checked='<%# Bind("cbHSDiploma") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbHSDiploma" runat="server" Checked='<%# Eval("cbHSDiploma") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbVocationalTraining" ItemStyle-CssClass="centered" SortExpression="cbVocationalTraining">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbVocationalTraining" runat="server" Checked='<%# Bind("cbVocationalTraining") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbVocationalTraining" runat="server" Checked='<%# Eval("cbVocationalTraining") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbCollegeDegree" ItemStyle-CssClass="centered" SortExpression="cbCollegeDegree">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbCollegeDegree" runat="server" Checked='<%# Bind("cbCollegeDegree") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbCollegeDegree" runat="server" Checked='<%# Eval("cbCollegeDegree") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbNoEdRequirement" ItemStyle-CssClass="centered" SortExpression="cbNoEdRequirement">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbNoEdRequirement" runat="server" Checked='<%# Bind("cbNoEdRequirement") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbNoEdRequirement" runat="server" Checked='<%# Eval("cbNoEdRequirement") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbWindows" ItemStyle-CssClass="centered" SortExpression="cbWindows">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbWindows" runat="server" Checked='<%# Bind("cbWindows") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbWindows" runat="server" Checked='<%# Eval("cbWindows") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMAC" ItemStyle-CssClass="centered" SortExpression="cbMAC">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMAC" runat="server" Checked='<%# Bind("cbMAC") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMAC" runat="server" Checked='<%# Eval("cbMAC") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbLinux" ItemStyle-CssClass="centered" SortExpression="cbLinux">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbLinux" runat="server" Checked='<%# Bind("cbLinux") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbLinux" runat="server" Checked='<%# Eval("cbLinux") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbNoOSRequirement" ItemStyle-CssClass="centered" SortExpression="cbNoOSRequirement">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbNoOSRequirement" runat="server" Checked='<%# Bind("cbNoOSRequirement") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbNoOSRequirement" runat="server" Checked='<%# Eval("cbNoOSRequirement") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMSWord" ItemStyle-CssClass="centered" SortExpression="cbMSWord">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMSWord" runat="server" Checked='<%# Bind("cbMSWord") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMSWord" runat="server" Checked='<%# Eval("cbMSWord") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMSExcel" ItemStyle-CssClass="centered" SortExpression="cbMSExcel">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMSExcel" runat="server" Checked='<%# Bind("cbMSExcel") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMSExcel" runat="server" Checked='<%# Eval("cbMSExcel") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMSPowerPoint" ItemStyle-CssClass="centered" SortExpression="cbMSPowerPoint">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMSPowerPoint" runat="server" Checked='<%# Bind("cbMSPowerPoint") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMSPowerPoint" runat="server" Checked='<%# Eval("cbMSPowerPoint") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMSAccess" ItemStyle-CssClass="centered" SortExpression="cbMSAccess">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMSAccess" runat="server" Checked='<%# Bind("cbMSAccess") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMSAccess" runat="server" Checked='<%# Eval("cbMSAccess") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMSPublisher" ItemStyle-CssClass="centered" SortExpression="cbMSPublisher">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMSPublisher" runat="server" Checked='<%# Bind("cbMSPublisher") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMSPublisher" runat="server" Checked='<%# Eval("cbMSPublisher") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbOtherSoftware" ItemStyle-CssClass="centered" SortExpression="cbOtherSoftware">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbOtherSoftware" runat="server" Checked='<%# Bind("cbOtherSoftware") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbOtherSoftware" runat="server" Checked='<%# Eval("cbOtherSoftware") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
 
            <asp:BoundField DataField="txtOtherSoftware" HeaderText="Other Software" SortExpression="txtOtherSoftware">
            <ItemStyle Wrap="False" />
            </asp:BoundField>
 
            <asp:TemplateField HeaderText="cbNoSoftwareRequirement" ItemStyle-CssClass="centered" SortExpression="cbNoSoftwareRequirement">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbNoSoftwareRequirement" runat="server" Checked='<%# Bind("cbNoSoftwareRequirement") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbNoSoftwareRequirement" runat="server" Checked='<%# Eval("cbNoSoftwareRequirement") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
 
            <asp:BoundField DataField="txtTypeWPM" HeaderText="Type WPM" SortExpression="txtTypeWPM">
            <ItemStyle Wrap="False" />
            </asp:BoundField>
            
             <asp:BoundField DataField="txtRequirementsComments" HeaderText="Req Comments" SortExpression="txtRequirementsComments">
            <ItemStyle Wrap="False" />
            </asp:BoundField>
           
            <asp:TemplateField HeaderText="Background Check" SortExpression="ddlBackgroundCheck">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlBackgroundCheck" runat="server" SelectedValue='<%# Bind("ddlBackgroundCheck") %>'>
                        <asp:ListItem>Select One...</asp:ListItem>
                        <asp:ListItem>None</asp:ListItem>
                        <asp:ListItem Value="Basic FDLE">Basic FDLE (Only if Company requires for employment.)</asp:ListItem>
                        <asp:ListItem Value="Level 2">Level 2 (Only for Child Care or Camps with youths under 5)</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblBackgroundCheck" runat="server" Text='<%# Bind("ddlBackgroundCheck") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Wrap="False" />
            </asp:TemplateField>
 
			<asp:TemplateField HeaderText="Accept Offenders" SortExpression="radAcceptCriminalBG">
				<EditItemTemplate>
					<asp:RadioButtonList ID="radAcceptCriminalBG" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" SelectedValue='<%# Bind("radAcceptCriminalBG") %>'>
	                <asp:ListItem>Yes</asp:ListItem>
	                <asp:ListItem>No</asp:ListItem>
	                <asp:ListItem>Call me to discuss</asp:ListItem>
					</asp:RadioButtonList>
				</EditItemTemplate>
				<ItemTemplate>
					<asp:Label ID="lblAcceptCriminalBG" runat="server" Text='<%# Bind("radAcceptCriminalBG") %>'></asp:Label>
				</ItemTemplate>
			</asp:TemplateField>
 
           <asp:TemplateField HeaderText="cbFingerprinting" ItemStyle-CssClass="centered" SortExpression="cbFingerprinting">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbFingerprinting" runat="server" Checked='<%# Bind("cbFingerprinting") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbFingerprinting" runat="server" Checked='<%# Eval("cbFingerprinting") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbDrugScreening" ItemStyle-CssClass="centered" SortExpression="cbDrugScreening">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbDrugScreening" runat="server" Checked='<%# Bind("cbDrugScreening") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbDrugScreening" runat="server" Checked='<%# Eval("cbDrugScreening") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbBilingual" ItemStyle-CssClass="centered" SortExpression="cbBilingual">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbBilingual" runat="server" Checked='<%# Bind("cbBilingual") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbBilingual" runat="server" Checked='<%# Eval("cbBilingual") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbEnglishSpanish" ItemStyle-CssClass="centered" SortExpression="cbEnglishSpanish">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbEnglishSpanish" runat="server" Checked='<%# Bind("cbEnglishSpanish") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbEnglishSpanish" runat="server" Checked='<%# Eval("cbEnglishSpanish") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbEnglishCreole" ItemStyle-CssClass="centered" SortExpression="cbEnglishCreole">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbEnglishCreole" runat="server" Checked='<%# Bind("cbEnglishCreole") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbEnglishCreole" runat="server" Checked='<%# Eval("cbEnglishCreole") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbMedicalTesting" ItemStyle-CssClass="centered" SortExpression="cbMedicalTesting">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbMedicalTesting" runat="server" Checked='<%# Bind("cbMedicalTesting") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbMedicalTesting" runat="server" Checked='<%# Eval("cbMedicalTesting") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="cbPrePlacementOrientation" ItemStyle-CssClass="centered" SortExpression="cbPrePlacementOrientation">
                <EditItemTemplate>
                    <asp:CheckBox ID="cbPrePlacementOrientation" runat="server" Checked='<%# Bind("cbPrePlacementOrientation") %>' name="Check4" />
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="cbPrePlacementOrientation" runat="server" Checked='<%# Eval("cbPrePlacementOrientation") %>' Enabled="false" />
                </ItemTemplate>
                <ControlStyle CssClass="centered" />
                <ItemStyle HorizontalAlign="Center" Wrap="False" />
            </asp:TemplateField>
 
			<asp:TemplateField HeaderText="Potential for Employment" SortExpression="radPotentialEmployment">
				<EditItemTemplate>
					<asp:RadioButtonList ID="radPotentialEmployment" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" SelectedValue='<%# Bind("radPotentialEmployment") %>'>
	                <asp:ListItem>Yes</asp:ListItem>
	                <asp:ListItem>No</asp:ListItem>
	                <asp:ListItem>Call me to discuss</asp:ListItem>
					</asp:RadioButtonList>
				</EditItemTemplate>
				<ItemTemplate>
					<asp:Label ID="radPotentialEmployment" runat="server" Text='<%# Bind("radPotentialEmployment") %>'></asp:Label>
				</ItemTemplate>
			</asp:TemplateField>
 
			<asp:TemplateField HeaderText="Interview Candidate" SortExpression="radInterviewCandidate">
				<EditItemTemplate>
					<asp:RadioButtonList ID="radInterviewCandidate" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" SelectedValue='<%# Bind("radInterviewCandidate") %>'>
	                <asp:ListItem>Yes</asp:ListItem>
	                <asp:ListItem>No</asp:ListItem>
	                <asp:ListItem>Call me to discuss</asp:ListItem>
					</asp:RadioButtonList>
				</EditItemTemplate>
				<ItemTemplate>
					<asp:Label ID="radInterviewCandidate" runat="server" Text='<%# Eval("radInterviewCandidate") %>'></asp:Label>
				</ItemTemplate>
			</asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            No Job Titles at selected Worksite or no Worksite selected.
        </EmptyDataTemplate>
        <HeaderStyle CssClass="grid-header" />
        <RowStyle CssClass="grid-row" />
        <AlternatingRowStyle CssClass="grid-alt-row" />
        <SelectedRowStyle CssClass="grid-selected-row" />
        <EditRowStyle CssClass="grid-edit-row" />
        <PagerStyle CssClass="grid-pager" />
        <EmptyDataRowStyle CssClass="grid-empty-row" />
        <FooterStyle CssClass="grid-footer" />
    </asp:GridView>

Open in new window

GridViewWontSelect.png
Avatar of David Robitaille
David Robitaille
Flag of Canada image

"But, when I click Select or Edit, nothing happens"
If you got those buttons, the problem should not be with the gridview itself... or maybe with one of your edit template??? Do you use ajax or something?
I suspect you get an error when you hit those buttons. (check at the lower left of IE)
You could alsy try to remove those columns one by one until it work.
 
Avatar of David Megnin

ASKER

Yeah, the error says "RadioButtonList has a SelectedValue which is invalid because it does not exist in the list of items."  That RadioButtonList is in a TemplateField of the GridView:

                  <asp:TemplateField HeaderText="Interview Candidate" SortExpression="radInterviewCandidate">
                        <EditItemTemplate>
                              <asp:RadioButtonList ID="radInterviewCandidate" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow" SelectedValue='<%# Bind("radInterviewCandidate") %>'>
                      <asp:ListItem>Yes</asp:ListItem>
                      <asp:ListItem>No</asp:ListItem>
                      <asp:ListItem>Call me to discuss</asp:ListItem>
                              </asp:RadioButtonList>
                        </EditItemTemplate>
                        <ItemTemplate>
                              <asp:Label ID="radInterviewCandidate" runat="server" Text='<%# Eval("radInterviewCandidate") %>'></asp:Label>
                        </ItemTemplate>
                  </asp:TemplateField>


I'm Googling for solutions to this problem but I'm finding all sorts of things and I can't make heads or tails of half of them.

One suggested adding a hidden ListItem:
                              <asp:ListItem Value="" Text="" style="display:none" />

That didn't solve my problem.  On some rows I do not get the error and on some I do.  I've tried looking in the database for clues but can not find a pattern.  I have 6 records that I can edit without the error and 4 that give me the error and no edit.  Both sets are a mix of selected items.  ?
ok, that should be easy to fix.
what is the content of : "radInterviewCandidate" it mutch match the conetnt of the value of the list item, specialy the one that gives error (SelectedValue='<%# Bind("radInterviewCandidate") try to find in within the options... )
ex
   <asp:ListItem Value="Yes" Text="Yes" />  
<asp:ListItem Value="No" Text="No"  />

  <asp:ListItem Value="Call" Text="Call me to discuss" />
 
Okay, I changed all the values in the database for "radInterviewCandidate" to "No" just to get past that.  That worked and revealed the same issue with a DropDown box that contains values like this with dashes:
<asp:ListItem Value="Office - Data Entry" Text="Office - Data Entry" />
<asp:ListItem Value="Office - Receptionist" Text="Office - Receptionist" />
<asp:ListItem Value="Office - Customer Service" Text="Office - Customer Service" />
<asp:ListItem Value="Office - Multi-functional Admin" Text="Office - Multi-functional Admin" />
<asp:ListItem Value="Warehouse" Text="Warehouse" />

I copied the values from the code page into the database and notice that the dashes were different.  They became longer in the database field than the original values in the database field.

I can now edit all the rows in my GridView, but I'm still getting the error on page about an Invalid value in the SelectedValue.
ASKER CERTIFIED SOLUTION
Avatar of David Robitaille
David Robitaille
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah, I copied the values from the ListItems to the database so that there was a DB field populated with each of the ListItems, including the "Select One..." item, yet I'm still getting the error.  I think I'll remove the dashes completely to eliminate that issue.  ...
ok, should work,i will wait for news on that.
 
Those d@mn dashes!  That seems to have been the problem.  One of the Items had two dashes, "Office - Multi-functional Admin" and I missed the second dash the first time through.  
It all seems to be working okay now.  

Is there a comprehensive turorial on GridViews that includes all the pitfalls, "gotchas" and quirks to wach out for?  I use them so much and I ALWAYS have problems.
Thank you for your help!!!
well, here is where I first learn ASP.NET.
http://www.asp.net/learn/data-access/
But i dont know a "comprehensive tutorial". you may try a book, but i got no title for you.
 
I've got that page bookmarked in every browser I use. ;-)

Thank you again!