Avatar of David Megnin
David Megnin
Flag for United States of America asked on

How to select a CheckBox in a GridView EditItemTemplate with a DropDownList OnChange event in same EditItemTemplate

In my GridView in Edit mode I've put a CheckBox in one field and a DropDownList in another field.

I need the CheckBox to be checked when the DropDownList is changed.

I thought I had accomplished this with the Onchange in the DropDownList below, but on looking in the source view when it didn't work (except on the top record) I noticed that the CheckBox that I'm trying to check is numbered according to what row it's on.
'GridView1_SeeSuccessCoach_0' only applies to the first row.
The CheckBox on the second row is 'GridView1_SeeSuccessCoach_1', etc.

How can I check the CB on whatever row is being edited?  The DropDownList OnChange of that row should be the trigger.  Thanks.

<asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="Prog" SortExpression="CaseManager">
			<EditItemTemplate>
				<%--<asp:TextBox ID="txtCaseManager" runat="server" Text='<%# Bind("CaseManager") %>'></asp:TextBox>--%>

    <asp:DropDownList ID="ddlCaseManager" runat="server" Text='<%# Bind("CaseManager") %>' AppendDataBoundItems="true"
        Onchange="document.getElementById('GridView1_SeeSuccessCoach_0').checked = Boolean(this.selectedIndex);" >
        <asp:ListItem Value="" Text="n/a"/>
        <asp:ListItem Value="AARP" Text="AARP" />
        <asp:ListItem Value="BDS" Text="BDS" />
        <asp:ListItem Value="EUC-RES" Text="EUC-RES" />
        <asp:ListItem Value="Gulf Coast" Text="Gulf Coast" />
        <asp:ListItem Value="OIC" Text="OIC" />
        <asp:ListItem Value="REA" Text="REA" />
        <asp:ListItem Value="SNAP" Text="SNAP" />
        <asp:ListItem Value="TAA" Text="TAA" />
        <asp:ListItem Value="TTW" Text="TTW" />
        <asp:ListItem Value="Vet" Text="Veteran" />
        <asp:ListItem Value="WIA" Text="WIA" />
        <asp:ListItem Value="WP" Text="WP" />
        <asp:ListItem Value="DHM" Text="DHM-T" />
        <asp:ListItem Value="WTP" Text="WTP" />
        <asp:ListItem Value="Youth" Text="Youth" />
        <asp:ListItem Value=" " Text=""/>
    </asp:DropDownList>

			</EditItemTemplate>
			<ItemTemplate>
				<asp:Label ID="lblCaseManager" runat="server" Text='<%# Eval("CaseManager") %>'></asp:Label>
			</ItemTemplate>
			<ControlStyle Width="100px" />
			<HeaderStyle BackColor="#0033EE" Font-Size="Smaller" />
			<ItemStyle Font-Size="Smaller" HorizontalAlign="Center" />
</asp:TemplateField>

Open in new window

ASP.NETJavaScript

Avatar of undefined
Last Comment
David Megnin

8/22/2022 - Mon
Rouchie

You have to use code-behind to do this, because as you've found, the ID value is different on every row.  This is roughly how it would be done...

Add the CheckBox into a TemplateField, calling it's ID "SeeSuccessCoach".  Then remove the onchange event you've added to the dropdownlist.  Then...

On the GridView.RowDataBound event, find both controls in code-behind:

Protected Sub MyGVRowDatabound(sender as object, e as GridViewRowEventArgs) handles myGV.RowDataBound
   Select Case e.Row.RowType
          Case DataControlRowType.DataRow
                 Dim ddlCaseManager as dropdownlist = ctype(e.row.findcontrol("ddlCaseManager"), DropDownList)
                 Dim SeeSuccessCoach as CheckBox = Ctype(e.row.findcontrol("SeeSuccessCoach"), CheckBox)
                  ddlCaseManager.Attributes.Add("onchange", "document.getElementById('" & ddlCaseManager.clientID & "').checked = Boolean(this.selectedIndex);")
   End Select
End Sub

Open in new window

David Megnin

ASKER
Oh, thanks for the code-behind in VB.  I didn't think to specify because I was hopeing for a simple JavaScript solution, but I see that that isn't posible.

Anyway, I'll give this a try and report back.  You said, "roughly how it would be  done..."  I'm going to try it, "exactly" like that since I wouldn't be able to code it myself.  ;-)
Rouchie

Sorry just spotted an error, it should be:

Protected Sub MyGVRowDatabound(sender as object, e as GridViewRowEventArgs) handles myGV.RowDataBound
   Select Case e.Row.RowType
          Case DataControlRowType.DataRow
                 Dim ddlCaseManager as dropdownlist = ctype(e.row.findcontrol("ddlCaseManager"), DropDownList)
                 Dim SeeSuccessCoach as CheckBox = Ctype(e.row.findcontrol("SeeSuccessCoach"), CheckBox)
                  ddlCaseManager.Attributes.Add("onchange", "document.getElementById('" & SeeSuccessCoach.clientID & "').checked = Boolean(this.selectedIndex);")
   End Select
End Sub

Open in new window


The code basically finds the ID of the rendered checkbox on each row of the gridview and adds some javascript to the neighbouring dropdownlist.  This can't be done purely in JS because you don't know either the ID values, or how many there will be.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
David Megnin

ASKER
Thank you for the update.  :-)
David Megnin

ASKER
I'm getting an Object Reference not set to an instance of an object error here.
I always hate seeing that error.  It's so confusing.

Server Error in '/OneStopSignIn' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error: 


Line 255:                Dim ddlCaseManager As DropDownList = CType(e.Row.FindControl("ddlCaseManager"), DropDownList)
Line 256:                Dim SeeSuccessCoach As CheckBox = CType(e.Row.FindControl("SeeSuccessCoach"), CheckBox)
Line 257:                ddlCaseManager.Attributes.Add("onchange", "document.getElementById('" & SeeSuccessCoach.ClientID & "').checked = Boolean(this.selectedIndex);")
Line 258:        End Select
Line 259:
 

Source File: E:\inetpub\www2\OneStopSignIn\Monitor.aspx.vb    Line: 257 

Stack Trace: 


[NullReferenceException: Object reference not set to an instance of an object.]
   Monitor.GridView1_RowDataBound(Object sender, GridViewRowEventArgs e) in E:\inetpub\www2\OneStopSignIn\Monitor.aspx.vb:257
   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +306
   System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +4587
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +93
   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +17
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +181
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +276
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +104
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +175
   System.Web.UI.Control.EnsureChildControls() +181
   System.Web.UI.Control.PreRenderRecursiveInternal() +72
   System.Web.UI.Control.PreRenderRecursiveInternal() +255
   System.Web.UI.Control.PreRenderRecursiveInternal() +255
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3887

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 

Open in new window

Rouchie

I think this means that the CheckBox isn't being found by the code behind.  Did you add it like I said?  Can you post the entire code for your GridView so I can see how you added it in?
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
David Megnin

ASKER
Yes.  I actually already had the CheckBox with that ID in a TemplateField.
                <asp:TemplateField HeaderText="SC" SortExpression="SeeSuccessCoach">
                    <EditItemTemplate>
                        <asp:CheckBox ID="SeeSuccessCoach" runat="server" Checked='<%# Bind("SeeSuccessCoach") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("SeeSuccessCoach").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>

Open in new window


Here is the entire GridView1 code.  That CheckBox is on Line 86 of that code block or about one fourth of the way down...

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White"
            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="CustomerID"
            AllowSorting="True" DataSourceID="SqlDataSource1" RowStyle-CssClass="GridRow" AlternatingRowStyle-CssClass="GridAltRow" HeaderStyle-CssClass="locked">
<AlternatingRowStyle CssClass="GridAltRow"></AlternatingRowStyle>
            <Columns>
                <asp:CommandField ShowEditButton="True" ShowDeleteButton="True" EditText="&#9679;"
                    DeleteImageUrl="images/Delete-icon.png" ButtonType="Image" EditImageUrl="images/edit_item.gif"
                    DeleteText="X" HeaderText="COMD&amp;bull;" 
                    CancelImageUrl="images/cancel_icon.png" UpdateImageUrl="images/save.png">
                <HeaderStyle Width="40px" />
                </asp:CommandField>
                <asp:BoundField DataField="CustomerID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
                    SortExpression="CustomerID" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName">
                    <ItemStyle Wrap="False" />
                    <ControlStyle Width="80px" />
                </asp:BoundField>
                <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName">
                    <ItemStyle Wrap="False" />
                    <ControlStyle Width="80px" />
                </asp:BoundField>
                <asp:BoundField DataField="SSN" HeaderText="SSN" SortExpression="SSN">
                    <ControlStyle Width="35px" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="Vet" SortExpression="AreVeteran">
                    <EditItemTemplate>
                        <asp:TextBox ID="AreVeteran" runat="server" Text='<%# Bind("AreVeteran") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("AreVeteran").ToString() = "Yes", "&hearts;", "")%>
                    </ItemTemplate>
                    <ControlStyle Width="30px" />
                    <ItemStyle HorizontalAlign="Center" ForeColor="Purple" Font-Size="Larger" Font-Overline="True"
                        Font-Underline="True" />
                </asp:TemplateField>

                <asp:BoundField DataField="DateTime" HeaderText="DateTime" SortExpression="DateTime"
                    DataFormatString="{0:g}" HtmlEncode="False" ReadOnly="True">
                    <HeaderStyle Wrap="False" Font-Size="Smaller" />
                    <ItemStyle Wrap="False" Font-Size="Smaller" />
                </asp:BoundField>

                <asp:TemplateField HeaderText="NS" SortExpression="NoShow" ConvertEmptyStringToNull="False">
                    <ItemTemplate>
                        <asp:CheckBox ID="cbNoShow" runat="server" AutoPostBack="True" OnCheckedChanged="cbNoShow_CheckedChanged"
                            Checked='<%# Convert.ToBoolean(Eval("NoShow")) %>' />
                    </ItemTemplate>
                    <HeaderStyle />
                    <ItemStyle HorizontalAlign="Center" />
                    <HeaderStyle Font-Size="Smaller" />
                    <ItemStyle Font-Size="Smaller" />
                </asp:TemplateField>

                <asp:BoundField DataField="NSWait" DataFormatString="{0:g}" HeaderText="NSWait" SortExpression="NSWait"
                    HtmlEncode="False" ReadOnly="True">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>

                <asp:BoundField DataField="Waiting" HeaderText="Wtg" SortExpression="Waiting" ReadOnly="True"
                    DataFormatString="{0:t}" HtmlEncode="False" />

                <asp:TemplateField HeaderText="RR" SortExpression="ResourceRoom">
                    <EditItemTemplate>
                        <asp:CheckBox ID="ResourceRoom" runat="server" Checked='<%# Bind("ResourceRoom") %>'/>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("ResourceRoom").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="RR&#9679;" SortExpression="Computer" ConvertEmptyStringToNull="False">
                    <ItemTemplate>
                        <asp:CheckBox ID="cbComputerItem" runat="server" AutoPostBack="True" OnCheckedChanged="cbComputerItem_CheckedChanged"
                            Checked='<%# Convert.ToBoolean(Eval("Computer")) %>' Visible='<%# IIf(Eval("ResourceRoom").ToString() = "True", True, False) %>' />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>

                <asp:BoundField DataField="RRWait" DataFormatString="{0:g}" HeaderText="RRWait" SortExpression="RRWait"
                    HtmlEncode="False" ReadOnly="True" >
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>

                <asp:TemplateField HeaderText="SC" SortExpression="SeeSuccessCoach">
                    <EditItemTemplate>
                        <asp:CheckBox ID="SeeSuccessCoach" runat="server" Checked='<%# Bind("SeeSuccessCoach") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("SeeSuccessCoach").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="SC&#9679;" SortExpression="SCServed" ConvertEmptyStringToNull="False">
                    <ItemTemplate>
                        <asp:CheckBox ID="cbSCServed" runat="server" AutoPostBack="True" OnCheckedChanged="cbSCServed_CheckedChanged"
                            Checked='<%# Convert.ToBoolean(Eval("SCServed")) %>' Visible='<%# IIf(Eval("SeeSuccessCoach").ToString() = "True", True, False) %>' />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:BoundField DataField="SCWait" HeaderText="SCWait" SortExpression="SCWait" DataFormatString="{0:g}"
                    HtmlEncode="False" ReadOnly="True" >
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>

                <asp:BoundField DataField="AppointmentTime" HeaderText="Appointment Time" SortExpression="AppointmentTime"
                    DataFormatString="{0:hh:mm tt}" HtmlEncode="False" ReadOnly="True">
                    <HeaderStyle Wrap="False" Font-Size="Smaller" />
                    <ItemStyle Wrap="False" Font-Size="Smaller" />
                </asp:BoundField>


                <asp:TemplateField ConvertEmptyStringToNull="False" HeaderText="Prog" SortExpression="CaseManager">
					<EditItemTemplate>
						<%--<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CaseManager") %>'></asp:TextBox>--%>

                    <asp:DropDownList ID="ddlCaseManager" runat="server" Text='<%# Bind("CaseManager") %>'
						AppendDataBoundItems="true">
                        <asp:ListItem Value="" Text="n/a"/>
                        <asp:ListItem Value="AARP" Text="AARP" />
                        <asp:ListItem Value="BDS" Text="BDS" />
                        <asp:ListItem Value="EUC-RES" Text="EUC-RES" />
                        <asp:ListItem Value="Gulf Coast" Text="Gulf Coast" />
                        <asp:ListItem Value="OIC" Text="OIC" />
                        <asp:ListItem Value="REA" Text="REA" />
                        <asp:ListItem Value="SNAP" Text="SNAP" />
                        <asp:ListItem Value="TAA" Text="TAA" />
                        <asp:ListItem Value="TTW" Text="TTW" />
                        <asp:ListItem Value="Vet" Text="Veteran" />
                        <asp:ListItem Value="WIA" Text="WIA" />
                        <asp:ListItem Value="WP" Text="WP" />
                        <asp:ListItem Value="DHM" Text="DHM-T" />
                        <asp:ListItem Value="WTP" Text="WTP" />
                        <asp:ListItem Value="Youth" Text="Youth" />
                        <asp:ListItem Value=" " Text=""/>
                    </asp:DropDownList>

					</EditItemTemplate>
					<ItemTemplate>
						<asp:Label ID="Label1" runat="server" Text='<%# Eval("CaseManager") %>'></asp:Label>
					</ItemTemplate>
					<ControlStyle Width="100px" />
					<HeaderStyle Font-Size="Smaller" />
					<ItemStyle Font-Size="Smaller" HorizontalAlign="Center" />
				</asp:TemplateField>


                <asp:TemplateField HeaderText="JobClb" SortExpression="JobClub">
                    <EditItemTemplate>
                        <asp:TextBox ID="JobClub" runat="server" Text='<%# Bind("JobClub") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("JobClub").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Disab" SortExpression="DisabilityServ">
                    <EditItemTemplate>
                        <asp:TextBox ID="DisabilityServ" runat="server" Text='<%# Bind("DisabilityServ") %>'
                            Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("DisabilityServ").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Bar" SortExpression="Barrier">
                    <EditItemTemplate>
                        <asp:TextBox ID="Barrier" runat="server" Text='<%# Bind("Barrier") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("Barrier").ToString() = "Yes", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="UnEmp" SortExpression="Unemployment">
                    <EditItemTemplate>
                        <asp:TextBox ID="Unemployment" runat="server" Text='<%# Bind("Unemployment") %>'
                            Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("Unemployment").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="VetS" SortExpression="VeteranServ">
                    <EditItemTemplate>
                        <asp:TextBox ID="VeteranServ" runat="server" Text='<%# Bind("VeteranServ") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("VeteranServ").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:BoundField DataField="Veteran" HeaderText="Vet" SortExpression="Veteran">
                    <HeaderStyle Font-Size="Smaller" />
                    <ItemStyle HorizontalAlign="Center" Font-Size="Smaller" />
                    <ControlStyle Width="40px" />
                </asp:BoundField>
                <asp:TemplateField HeaderText="InterV" SortExpression="Interview">
                    <EditItemTemplate>
                        <asp:TextBox ID="Interview" runat="server" Text='<%# Bind("Interview") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("Interview").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Bond" SortExpression="BondingProgram">
                    <EditItemTemplate>
                        <asp:TextBox ID="BondingProgram" runat="server" Text='<%# Bind("BondingProgram") %>'
                            Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("BondingProgram").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Train" SortExpression="Training">
                    <EditItemTemplate>
                        <asp:TextBox ID="Training" runat="server" Text='<%# Bind("Training") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("Training").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="WkShp" SortExpression="Workshop">
                    <EditItemTemplate>
                        <asp:TextBox ID="Workshop" runat="server" Text='<%# Bind("Workshop") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("Workshop").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Info" SortExpression="GeneralInfo">
                    <EditItemTemplate>
                        <asp:TextBox ID="GeneralInfo" runat="server" Text='<%# Bind("GeneralInfo") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("GeneralInfo").ToString() = "True", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="1stVisit" SortExpression="FirstVisit">
                    <EditItemTemplate>
                        <asp:TextBox ID="FirstVisit" runat="server" Text='<%# Bind("FirstVisit") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("FirstVisit").ToString() = "Yes", "&clubs;", "")%>
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Employed" SortExpression="Employed">
                    <EditItemTemplate>
                        <asp:TextBox ID="Employed" runat="server" Text='<%# Bind("Employed") %>' Width="40px" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <%#IIf(Eval("Employed").ToString() = "Yes", "&clubs;", "")%>
                    </ItemTemplate>
                    <HeaderStyle Font-Size="X-Small" />
                    <ItemStyle HorizontalAlign="Center" ForeColor="Black" />
                </asp:TemplateField>
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email">
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="Office" HeaderText="Office" SortExpression="Office" ReadOnly="True">
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="NSUser" HeaderText="NSUser" SortExpression="NSUser" ReadOnly="True">
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="RRUser" HeaderText="RRUser" SortExpression="RRUser" ReadOnly="True">
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:BoundField DataField="SCUser" HeaderText="SCUser" SortExpression="SCUser" ReadOnly="True">
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
            </Columns>
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <RowStyle ForeColor="#000066" />
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#F1F1F1" />
            <SortedAscendingHeaderStyle BackColor="#007DBB" />
            <SortedDescendingCellStyle BackColor="#CAC9C9" />
            <SortedDescendingHeaderStyle BackColor="#00547E" />
        </asp:GridView>

Open in new window

ASKER CERTIFIED SOLUTION
Rouchie

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
David Megnin

ASKER
You are good!  It works like a charm.
David Megnin

ASKER
That works perfectly.  Thank you so much!  I'll have to remember that about the Edit Mode of the GridView control.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
David Megnin

ASKER
I have another issue with that same gridview I'm about to post.  I hope you can help me with it as well.  ;-)