1
我已綁定的GridView到LINQ結果和設置的AutoGenerateColumns爲true,並啓用視圖狀態的網格視圖和所有還沒呈現,HTML瀏覽器中顯示爲空的GridView不會呈現
<div></div>
是什麼奇怪的是,在在文件系統中的ASP.NET開發服務器它是可見的沒有問題,但當我在互聯網上託管它不是!
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:asyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate >
<asp:GridView dir="rtl" ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" CellPadding="4" AutoGenerateColumns="true"
ForeColor="#333333" GridLines="Vertical" ViewStateMode="Enabled"
Width="917px" style=" padding-bottom:20px;" EnableViewState="True">
<AlternatingRowStyle BackColor="White" />
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White"
HorizontalAlign="Right" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
<br />
<br />
</ContentTemplate>
</asp:UpdatePanel>
通過我嘗試也刪除Ajax控件的方式,但它並沒有解決問題
LINQ的代碼很複雜,但我可以告訴你這個
tmp = (From p In results Where p.ShowProduct
Select New With {.المادة = p.ProductName,
.السعر = If(p.Setting.ShowPrices, If(p.ShowPrice, (p.SellPrice * p.Setting.ConversionToDollar).ToString, " - "), " - "),
.الكمية = If(p.Setting.ShowCounts, If(p.ShowCount, CSng(p.Count) & " " & p.Unit, " - "), " - "),
.الصنف = p.Category,
.الوصف = p.Description,
.المنشأ = p.Manufacturer,
.المحل = If(p.Setting.ShowAddress,
If(p.Setting.ShowMobile,
p.Setting.NameOfShop & "/" & p.Setting.ShopAddress & "/" & p.Setting.Mobile,
p.Setting.NameOfShop & "/" & p.Setting.ShopAddress & "/ -"),
If(p.Setting.ShowMobile,
p.Setting.NameOfShop & "/ - /" & p.Setting.Mobile,
p.Setting.NameOfShop & "/ -/- ")),
.التاريخ = p.LastUpdate}).ToList.OrderByDescending(Function(n) n.GetType().GetProperty(GridViewSortExpression).GetValue(n, Nothing)).ToList
End If
ResultCount = results.Count
GridView1.DataSource = tmp
' GridView1.ViewStateMode = UI.ViewStateMode.Enabled
GridView1.DataBind()
我也試圖把該行的代碼
UpdatePanel1.Update()
請幫我
是LINQ查詢返回結果在現場ENV? –
是的,你可以看到變量RESULTCOUNT個,它返回的實際行算作預期,但在GridView不存在**只有在線(互聯網)**! –
結果是,你是從,當然它會有個計數查詢集合。在現場環境中,執行linq查詢後,變量tmp是否有任何數據? – Sinaesthetic