1. That's just it. This is the startup page, a very vanilla grid with
almost no code until I started trying to install a dropdown. Just bind the
gridview to a data source and display. It's always in ReadOnly mode. On the
surface I can't see any way the ddl could cause this problem. (Could the
problem be caused by having the ddl's ODS included within the header
template?)
2. Yes, ObjectDataSource1 is the ods for the grid.
Actually I did modify the code slightly. The event handlers now all do it
this way:
If Session("UnitFilter") <> "" Then
ObjectDataSource1.FilterExpression = "RK_Unit=" +
Session("UnitFilter")
GridView1.DataBind()
End If
Here's the complete html of the page:
<%@ Page Language="vb" MasterPageFile="~/Site1.Master"
AutoEventWireup="false" Codebehind="Default.aspx.vb"
Inherits="GM_Project_Application_2._Default" Theme="default" %>
<asp:Content ID="Content1" runat="server"
ContentPlaceHolderID="ContentPlaceHolder1">
<asp:CheckBox ID="chkAll" runat="server" AutoPostBack="True" Text="View
All" /><br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False"
CellPadding="4" DataKeyNames="PK" DataSourceID="ObjectDataSource1"
ForeColor="#333333"
GridLines="None" Width="100%" PageSize="15" AllowSorting="True">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="PK" HeaderText="PK"
InsertVisible="False" ReadOnly="True"
SortExpression="PK" Visible="False" />
<asp:TemplateField HeaderText="Unit" SortExpression="RK_Unit">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("UnitName") %>'></asp:TextBox>
</EditItemTemplate>
<HeaderTemplate>
<asp:Label ID="Label2" runat="server"
Text="Unit"></asp:Label><br />
<asp
ropDownList ID="ddlUnit" runat="server"
DataSourceID="ObjectDataSourceUnit"
DataTextField="Item" DataValueField="PK"
AutoPostBack="True" OnPreRender="SetValue"
OnDataBound="ddlUnit_DataBound"
OnSelectedIndexChanged="ddlUnit_SelectedIndexChanged">
</asp
ropDownList><asp:ObjectDataSource
ID="ObjectDataSourceUnit" runat="server"
OldValuesParameterFormatString="{0}"
SelectMethod="GetData"
TypeName="GM_Project_Application_2.GMPATableAdapters.ztblPicklistTableAdapter">
<SelectParameters>
<asp
arameter DefaultValue="ABACUS"
Name="Group" Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblUnitName" runat="server" Text='<%#
Eval("UnitName") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:BoundField DataField="PGName" HeaderText="Product Group"
SortExpression="RK_PG">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="ID" HeaderText="Local Project ID"
SortExpression="ID">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="AlternateProjectId" HeaderText="Alt.
Proj ID" SortExpression="AlternateProjectId">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="Name" HeaderText="Project Name"
SortExpression="Name">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="ClassName"
HeaderText="Classification" SortExpression="RK_Class">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:BoundField DataField="G0" DataFormatString="{0:MM/dd/yyyy}"
HeaderText="G0 Date"
SortExpression="G0" HtmlEncode="False">
<HeaderStyle HorizontalAlign="Left" VerticalAlign="Top" />
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:HyperLinkField DataNavigateUrlFields="PK"
DataNavigateUrlFormatString="ListItems.aspx?ProjectId={0}"
HeaderText="Project Details" Text="View Details">
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle VerticalAlign="Top" />
</asp:HyperLinkField>
</Columns>
<PagerStyle BackColor="#284775" ForeColor="White"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True"
ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
DeleteMethod="Delete"
InsertMethod="Insert" OldValuesParameterFormatString="{0}"
SelectMethod="GetData"
TypeName="GM_Project_Application_2.GMPATableAdapters.tblProjectTableAdapter"
UpdateMethod="Update">
<DeleteParameters>
<asp
arameter Name="PK" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp
arameter Name="RK_Unit" Type="Int32" />
<asp
arameter Name="RK_PG" Type="Int32" />
<asp
arameter Name="ID" Type="String" />
<asp
arameter Name="Name" Type="String" />
<asp
arameter Name="Desc" Type="String" />
<asp
arameter Name="RK_Class" Type="Int32" />
<asp
arameter Name="G0" Type="DateTime" />
<asp
arameter Name="Notes" Type="String" />
<asp
arameter Name="PK" Type="Int32" />
<asp
arameter Name="IsNull_ts" Type="String" />
<asp
arameter Name="ts" Type="Object" />
</UpdateParameters>
<InsertParameters>
<asp
arameter Name="RK_Unit" Type="Int32" />
<asp
arameter Name="RK_PG" Type="Int32" />
<asp
arameter Name="ID" Type="String" />
<asp
arameter Name="Name" Type="String" />
<asp
arameter Name="Desc" Type="String" />
<asp
arameter Name="RK_Class" Type="Int32" />
<asp
arameter Name="G0" Type="DateTime" />
<asp
arameter Name="Notes" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<table width="100%">
<tr width="100%">
<td align="left">
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="ListItems.aspx?ProjectId=-1">Add Project</asp:HyperLink>
</td>
<td align="right">
<asp:HyperLink ID="HyperLink2" runat="server"
NavigateUrl="~/DisplayEmployees.aspx"
Visible="False">View Employees</asp:HyperLink>
</td>
</tr>
</table>
</asp:Content>