简体   繁体   English

ASP.Net和Datasource的白页错误

[英]White Page Bug with ASP.Net and Datasource

I am using a Datalist using SqlDatasource on a usercontrol. 我在usercontrol上使用SqlDatasource的Datalist。 Below is the html 下面是html

<asp:DataList ID="dlFeaturedCatalogs" runat="server" RepeatColumns="2" Width="100%"
                                        Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
                                        Font-Underline="False" ShowFooter="False" CellPadding="4" 
                                        ForeColor="#333333" DataSourceID="FCDatasource" 
                                        DataKeyField="Id">
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <AlternatingItemStyle BackColor="White" ForeColor="#284775" />
                                        <ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <ItemTemplate>
                                            <table>
                                                <tr>
                                                    <td style="padding-left: 5px; text-align: left; vertical-align: middle; font-size: 11px">
                                                        <asp:Image ID="imgList" runat="server" ImageAlign="AbsMiddle" ImageUrl="~/images/company.jpg" />
                                                        <asp:HyperLink ID="hlCategory" ForeColor="#005aa3" Font-Underline="false" runat="server"
                                                            NavigateUrl='<%# ResolveUrl(string.Format("~/BusinessBazaarAspx/CompDetls.aspx?cid={0}&name={1}",Common.EncodeTo64(Eval("Id").ToString()),Common.EncodeTo64(Eval("Name").ToString()) )) %>'
                                                            Text=' <%#Eval("Name") %>' Target="_blank"> </asp:HyperLink>
                                                    </td>
                                                </tr>
                                            </table>
                                        </ItemTemplate>
                                    </asp:DataList>

                            <asp:SqlDataSource ID="FCDatasource" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:BusinessBazaarConnectionString %>" 
                                SelectCommand="SELECT [CompanyId], [CompanyName] FROM [tbl_Company] ORDER BY [CompanyName]">
                            </asp:SqlDataSource>

I am not using any serverside code. 我没有使用任何服务器端代码。 Whenever I use to run it the parent page becomes entire white. 每当我用它来运行它时,父页面就变成了整个白色。 Why???? 为什么????

Update 更新

Final result i am getting, I have lots of user controls and databinding there. 我得到的最终结果,我有很多用户控件和数据绑定。 No thing rendering. 没有渲染的东西。 Seems entire page viewstate is going false. 似乎整个页面viewstate都是假的。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>

Please help me 请帮我

Try to put at least Response.Write("Test"); 尝试至少放置Response.Write("Test"); in the Page_Load on the server side code, do you see this in the browser? 在服务器端代码的Page_Load中,您是否在浏览器中看到了这一点?

could it be that you are returning no records from the database? 可能是你没有从数据库中返回任何记录?

("I am not using any serverside code" that's not true, but nvm.) (“我没有使用任何服务器端代码”,这不是真的,但是nvm。)

try using this in a simple label or something, and after it works add the images and hyperlinks, dont try to do complicated stuff, do it step-by-step: 尝试在一个简单的标签或其他东西中使用它,并在它工作后添加图像和超链接,不要尝试做复杂的东西,一步一步做:

Text=' <%#Eval("Name") %>'

or 要么

Text='<%# DataBinder.Eval(Container.DataItem, "Name")%>'

Also, binding the datasource would be easier to do/test in code-behind. 此外,绑定数据源将更容易在代码隐藏中进行/测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM