ASP.Net 和数据源的白页错误
我正在用户控件上使用 SqlDatasource 来使用数据列表。 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>
下面是我没有使用任何服务器端代码的 。每当我用来运行它时,父页面就会变成全白色。为什么????
更新
我得到的最终结果,我有很多用户控件和数据绑定。没有渲染任何东西。似乎整个页面视图状态都变错误了。
<!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>
请帮我
I am using a Datalist using SqlDatasource on a usercontrol. Below is the 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.
<!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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在服务器端代码的 Page_Load 中至少放置
Response.Write("Test");
,您在浏览器中看到这个吗?可能是您没有从数据库返回任何记录吗?
Try to put at least
Response.Write("Test");
in the Page_Load on the server side code, do you see this in the browser?could it be that you are returning no records from the database?
(“我没有使用任何服务器端代码”,这不是真的,而是 nvm。)
尝试在简单的标签或其他东西中使用它,在它工作后添加图像和超链接,不要尝试做复杂的事情,一步一步地做-step:
或者
此外,绑定数据源会更容易在代码隐藏中进行/测试。
("I am not using any serverside code" that's not true, but 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:
or
Also, binding the datasource would be easier to do/test in code-behind.