ページの読み込み時に表示されないグリッドビューがあります。グリッドビューは、更新パネル内にあるいくつかの asp:Panels 内にあります。コードをステップ実行したので、グリッドビューにデータ行があることがわかりました。グリッドビューをパネルの外に移動してパネルを更新すると、データが表示されます。パネルの下、パネルの内側、および更新パネルにあるときに機能しない理由を誰かが知っていますか?
<%@ Page Language="VB" AutoEventWireup="false" EnableEventValidation="false" MasterPageFile="~/CTPublic.master" CodeFile="Tank.aspx.vb" Inherits="CargoTank_Internal_Tank" %>
<div style="padding-top:9px; width:100%; min-width:800px; " >
<asp:UpdatePanel ID="udpTank" runat="server" >
<ContentTemplate>
<ajaxToolkit:RoundedCornersExtender runat="server" BorderColor="#3260a0" Corners="All" Radius="5" Color="#98B9C9" TargetControlID="pnlTank" ID="ajRCEpnlTank" ></ajaxToolkit:RoundedCornersExtender>
<asp:Panel runat="server" BackColor="#ecece7" Width="95%" ID="pnlTank" >
<div >
<div style="float:left; width:70%; background-color:#98B9C9; height:19px;">Tanks</div>
<div style="float:right; width:30%; height:19px;background-color:#98B9C9; text-align:right">
<asp:Button ID="btnAddNewTank" style="background:transparent; border:0px;" runat="server" Font-Underline="true" size="1" Font-Bold=true text="Add New" />
</div>
<div style="padding-top:19px;"></div>
</div>
<div style="width:100%;">
<table width="100%">
<tr>
<td colspan="6" class="tdheaderbar">Search Tanks
</td>
</tr>
<tr>
<td>CT #</td>
<td><asp:TextBox runat="server" ID="txtCTNumber" ></asp:TextBox></td>
<td>Serial #</td>
<td><asp:TextBox runat="server" ID="txtSerialNumber" MaxLength="17"></asp:TextBox></td>
<td>City</td>
<td><asp:TextBox runat="server" ID="txtCity"></asp:TextBox></td>
</tr>
<tr>
<td>Capacity</td>
<td><asp:TextBox runat="server" ID="txtCapacity"></asp:TextBox></td>
<td>Unit #</td>
<td><asp:TextBox runat="server" ID="txtUnitNumber"></asp:TextBox></td>
<td>License State</td>
<td><asp:DropDownList EnableViewState="true" runat="server" ID="ddlState" DataSourceID="linqStates"
Width="156px" DataTextField="StateText" DataValueField="StateID"></asp:DropDownList>
<asp:LinqDataSource ID="linqStates" runat="server"
ContextTypeName="DataClassesDataContext" TableName="States">
</asp:LinqDataSource>
</td>
</tr>
<tr>
<td>Tank Type</td>
<td>
<asp:DropDownList runat="server" ID="ddlTankType" Width="156px"
></asp:DropDownList>
</td>
<td>Compartment</td>
<td><asp:TextBox runat="server" ID="txtCompartment"></asp:TextBox></td>
<td>License #</td>
<td><asp:TextBox runat="server" ID="txtLicenseNumber"></asp:TextBox></td>
</tr>
<tr>
<td>Manufacturer</td>
<td colspan="2">
<asp:DropDownList runat="server" ID="ddlManufacturer"
></asp:DropDownList>
</td>
<td><asp:CheckBox runat="server" ID="chkNoLogIn" Text="No Log In Associated" /></td>
<td></td> <td></td>
</tr>
<tr><td>Company</td>
<td colspan="5"> <asp:DropDownList runat="server" ID="ddlCompany" ></asp:DropDownList></td>
</tr>
<tr>
<td colspan="3">
</td>
<td><asp:Button runat="server" ID="btnSearch" Text="Search" /></td>
</tr>
</table>
</div>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
<br />
<div style="padding-top:9px; width:100%; " id="divTankDetail" runat="server">
<asp:UpdatePanel ID="updTankDetail" runat="server" >
<ContentTemplate>
<ajaxToolkit:DropShadowExtender runat="server" ID="dsetank" TargetControlID="pnlTankDetail" TrackPosition="true" BehaviorID="pnlTankDetailHeader"></ajaxToolkit:DropShadowExtender>
<ajaxToolkit:DragPanelExtender runat="server" ID="dpeTankDetail" TargetControlID="pnlTankDetail" DragHandleID="pnlTankDetailHeader"></ajaxToolkit:DragPanelExtender>
<asp:Panel CssClass="TankpopupPosition" BackColor="LightBlue" Visible="false" runat="server" BorderColor="#3260a0" BorderWidth="2px" Width="801px" ID="pnlTankDetail" >
<asp:Panel runat="server" BorderColor="#3260a0" BorderWidth="1px" Width="800px" ID="pnlTankDetailHeader">
<div >
<div style="float:left; width:90%; background-color:#98B9C9; height:19px;">Tank Detail</div>
<div style="float:right; width:10%; border-right-width:2px; border-width:1px; border-color:#3260a0; height:19px;background-color:#98B9C9; text-align:right">
<asp:Button ID="btnClose" style="background:transparent; border:0px;" runat="server" size="1" Font-Bold=true text="X" />
</div>
<div style="padding-top:19px;"></div>
</div>
</asp:Panel>
<asp:Panel runat="server" Width="800px" ID="pnlTankDetailBody">
<div id="divTankDetailbody" runat="server" style="width:100%" >
<br />
<table width="100%">
<tr>
<td>CT #</td>
<td><asp:TextBox TabIndex="10" runat="server" BorderStyle="Inset" BorderColor="White" BorderWidth="2px" BackColor="Transparent" ID="txtCTNum" ReadOnly="true" ></asp:TextBox>
<asp:Label ID="lblCTNumber" runat="server" Text="*"></asp:Label> </td>
<td>Serial #</td>
<td><asp:TextBox TabIndex="14" runat="server" BorderStyle="Inset" BorderColor="White" BorderWidth="2px" ID="txtSeriaNum" MaxLength="17"></asp:TextBox>
<asp:Label ID="lblSerialNumber" runat="server" Text="*"></asp:Label> </td>
<td>City</td>
<td><asp:TextBox runat="server" TabIndex="18" BorderStyle="Inset" BorderColor="White" BorderWidth="2px" ID="txtOrignatedCity"></asp:TextBox></td>
</tr>
<tr>
<td>Capacity</td>
<td><asp:TextBox TabIndex="11" runat="server" BorderStyle="Inset" BorderColor="White" BorderWidth="2px" ID="txtTanktCapacity"></asp:TextBox>
<asp:Label ID="lblCapacity" runat="server" Text="*"></asp:Label> </td>
<td>Compartment</td>
<td><asp:TextBox runat="server" TabIndex="15" ID="txtCompartment2" BorderStyle="Inset" BorderColor="White" BorderWidth="2px"></asp:TextBox>
<asp:Label ID="lblCompartment" runat="server" Text="*"></asp:Label> </td>
<td>License #</td>
<td><asp:TextBox runat="server" BorderStyle="Inset" TabIndex="19" BorderColor="White" BorderWidth="2px" ID="txtLicenseNum"></asp:TextBox></td>
</tr>
<tr>
<td>Tank Type</td>
<td>
<asp:DropDownList runat="server" TabIndex="12" ID="ddlTankType2" Width="156px"
DataTextField="TankTypeName"
DataValueField="TankTypeName"></asp:DropDownList><asp:Label ID="lblTankType" runat="server" Text="*"></asp:Label> 
</td>
<td>Unit #</td>
<td><asp:TextBox runat="server" TabIndex="16" BorderStyle="Inset" BorderColor="White" BorderWidth="2px" ID="txtUnitNum"></asp:TextBox></td>
<td>License State</td>
<td>
<asp:DropDownList EnableViewState="true" Width="156px" TabIndex="20" runat="server" ID="ddlLicenseState" DataSourceID="linqStates"
DataTextField="StateText" DataValueField="StateID"></asp:DropDownList>
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="DataClassesDataContext" TableName="States">
</asp:LinqDataSource>
</td>
</tr>
<tr>
<td>Manufacturer</td>
<td colspan="1">
<asp:DropDownList runat="server" TabIndex="13" ID="ddlManufacturer2"
>
</asp:DropDownList><asp:Label ID="lblManufacturer" runat="server" Text="*"></asp:Label> 
</td>
<td>Company</td>
<td colspan="3"> <asp:DropDownList runat="server" TabIndex="17" ID="ddlCompany2" ></asp:DropDownList><asp:Label ID="lblCompany2" runat="server" Text="*"></asp:Label></td>
</tr>
<tr>
<td colspan="6" align="center"><br />
<asp:Label ID="lblChangeOwnership" Font-Size="Medium" runat="server"></asp:Label>
<br />
<asp:CheckBox ID="chkChangeOwnership" runat="server" Text="Changing ownership" ForeColor="Red" Font-Bold="true" />
</td>
</tr>
<tr>
<td colspan="6" align="center">
<br />
<asp:Button runat="server" ID="btnAdd" TabIndex="21" Text="Add" Width="60px" />
<asp:Button runat="server" ID="btnUpdate" TabIndex="22" Text="Update" Width="60px" />
<asp:Button runat="server" ID="btnChangeOnwership" TabIndex="23" Text="Change" Width="60px" />
<asp:Button runat="server" ID="btnCancel" TabIndex="24" Text="Cancel" Width="60px" />
<br /><br />
<asp:GridView ID="grdTanks" runat="server" AllowPaging="True"
AutoGenerateColumns="False" BackColor="Transparent" GridLines="None"
PagerSettings-Mode="NumericFirstLast" PageSize="10"
RowStyle-HorizontalAlign="left" Width="100%">
<AlternatingRowStyle CssClass="alternateItemStyle" />
<HeaderStyle CssClass="headerStyle" />
<PagerSettings Mode="NumericFirstLast" />
<RowStyle CssClass="itemStyle" />
<Columns>
<asp:BoundField DataField="CargoTankID" HeaderText="CT #" InsertVisible="False"
ReadOnly="True" SortExpression="CargoTankID" />
<asp:BoundField DataField="CompanyID" HeaderText="CompanyID"
SortExpression="CompanyID" Visible="false" />
<asp:BoundField DataField="OriginatedCity" HeaderText="OriginatedCity"
SortExpression="OriginatedCity" Visible="false" />
<asp:BoundField DataField="LicenseNumber" HeaderText="LicenseNumber"
SortExpression="LicenseNumber" Visible="false" />
<asp:BoundField DataField="LicenseState" HeaderText="LicenseState"
SortExpression="LicenseState" Visible="false" />
<asp:BoundField DataField="UnitNumber" HeaderText="Unit Number"
SortExpression="UnitNumber" Visible="false" />
<asp:TemplateField HeaderText="Company">
<ItemTemplate>
<%#DisplayCompanyName(Eval("CompanyID"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="SerialNumber" HeaderText="Serial Number"
SortExpression="SerialNumber" />
<asp:BoundField DataField="Capacity" HeaderText="Capacity"
SortExpression="Capacity" />
<asp:TemplateField HeaderText="Manufacturer">
<ItemTemplate>
<%#DisplayManufacturer(Eval("ManufacturerID"))%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TankType" HeaderText="Tank Type"
SortExpression="TankType" Visible="false" />
<asp:BoundField DataField="Compartment" HeaderText="Compartment"
SortExpression="Compartment" Visible="false" />
<asp:BoundField DataField="DecalID" HeaderText="DecalID"
SortExpression="DecalID" Visible="false" />
<asp:TemplateField HeaderText="Decal Status">
<ItemTemplate>
<%#DisplayTestLink(Eval("CargoTankID"))%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</div>
</asp:Panel>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
これが私のコードビハインドです:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If (Me.Page.User.Identity.IsAuthenticated) Then
Dim db As DataClassesDataContext = New DataClassesDataContext()
Dim tanks = From t In db.CT_Tanks _
Select t
Me.grdTanks.DataSource = tanks
Me.grdTanks.DataBind()
Dim tanktype = (From t In db.CT_TankTypes _
Select t).ToList
ddlTankType.DataSource = tanktype
ddlTankType.DataTextField = "TankTypeName"
ddlTankType.DataValueField = "TankTypeName"
ddlTankType.DataBind()
ddlTankType.Items.Insert(0, "-- Select a Type --")
ddlTankType2.DataSource = tanktype
ddlTankType2.DataTextField = "TankTypeName"
ddlTankType2.DataValueField = "TankTypeName"
ddlTankType2.DataBind()
ddlTankType2.Items.Insert(0, "-- Select a Type --")
Dim manufacturer = (From m In db.CT_Manufacturers _
Select m).ToList
ddlManufacturer.DataSource = manufacturer
ddlManufacturer.DataTextField = "ManufacturerName"
ddlManufacturer.DataValueField = "ManufacturerID"
ddlManufacturer.DataBind()
ddlManufacturer.Items.Insert(0, "-- Select a Manufacturer --")
ddlManufacturer2.DataSource = manufacturer
ddlManufacturer2.DataTextField = "ManufacturerName"
ddlManufacturer2.DataValueField = "ManufacturerID"
ddlManufacturer2.DataBind()
ddlManufacturer2.Items.Insert(0, "-- Select a Manufacturer --")
Dim companies = (From c In db.CT_Companies _
Where c.IsOwner = True _
Select c Order By c.CompanyName Ascending).ToList
ddlCompany.DataSource = companies
ddlCompany.DataTextField = "CompanyName"
ddlCompany.DataValueField = "CompanyID"
ddlCompany.DataBind()
ddlCompany.Items.Insert(0, "-- Select a Company --")
ddlCompany2.DataSource = companies
ddlCompany2.DataTextField = "CompanyName"
ddlCompany2.DataValueField = "CompanyID"
ddlCompany2.DataBind()
ddlCompany2.Items.Insert(0, "-- Select a Company --")
End If
End If
End Sub