新闻发布系统(增删改页面)控件ID

njuRF njuRF 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
“DetailsView1”的 DataSourceID 必须是 IDataSource 类型的控件的 ID。未能找到 ID 为“SqlSource”的控件。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Web.HttpException: “DetailsView1”的 DataSourceID 必须是 IDataSource 类型的控件的 ID。未能找到 ID 为“SqlSource”的控件。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[HttpException (0x80004005): “DetailsView1”的 DataSourceID 必须是 IDataSource 类型的控件的 ID。未能找到 ID 为“SqlSource”的控件。]
System.Web.UI.WebControls.DataBoundControl.GetDataSource() +309
System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +197
System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +43
System.Web.UI.Control.LoadRecursive() +92
System.Web.UI.Control.LoadRecursive() +214
System.Web.UI.Control.AddedControl(Control control, Int32 index) +849
System.Web.UI.ControlCollection.Add(Control child) +359
System.Web.UI.WebControls.LoginView.CreateChildControls() +426
System.Web.UI.Control.EnsureChildControls() +140
System.Web.UI.Control.PreRenderRecursiveInternal() +124
System.Web.UI.Control.PreRenderRecursiveInternal() +292
System.Web.UI.Control.PreRenderRecursiveInternal() +292
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4775
求高手帮忙。。。这个错误什么意思,能帮忙改下代码吗?小弟跪谢!!===========================================================================================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="newsAdminDetail.aspx.cs" Inherits="newsAdminDetail" validateRequest="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>新闻公告系统-管理</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a class="nav" href="newsAdmin.aspx">回到管理主页面</a> 
<asp:LoginStatus ID="LoginStatus2" runat="server" CssClass="nav" LogoutAction="Redirect" LogoutPageUrl="~/news.aspx" />
   </td>
</tr>
<tr style="font-size: 12pt; color: #000000">
<td>
<img alt="" border="0" height="15" name="newsCenter_r3_c2" src="image/newsCenter_r3_c2.jpg"
width="452" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr style="font-size: 12pt; color: #000000">
<td align="center" background="images/newsCenter_r4_c1.jpg" style="width: 644px">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<br />
<img src="image/shou.jpg" />请您先执行
<asp:LoginStatus ID="LoginStatus1" runat="server" />
操作!<br />
<br />
</AnonymousTemplate>
<LoggedInTemplate>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" BorderWidth="0px"
Caption="新闻数据管理" CellPadding="4" CellSpacing="1" CssClass="forumline" DataKeyNames="news_id"
DataSourceID="SqlSource" DefaultMode="Edit" Height="50px" Width="95%">
<CommandRowStyle HorizontalAlign="Center" />
<RowStyle CssClass="row1" HorizontalAlign="Left" />
<Fields>
<asp:TemplateField HeaderText="类别">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Bind("news_type") %>'>
<asp:ListItem Selected="True">政治</asp:ListItem>
<asp:ListItem>经济</asp:ListItem>
<asp:ListItem>文体</asp:ListItem>
<asp:ListItem>生活</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<InsertItemTemplate>
<asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("news_type") %>'>
<asp:ListItem Selected="True">政治</asp:ListItem>
<asp:ListItem>经济</asp:ListItem>
<asp:ListItem>文体</asp:ListItem>
<asp:ListItem>生活</asp:ListItem>
<asp:ListItem>其他</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="日期">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("news_date") %>'></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:Label ID="Label1" runat="server" Text="<%# System.DateTime.Now %>"></asp:Label>
</InsertItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="news_subject" HeaderText="标题" SortExpression="news_subject" />
<asp:BoundField DataField="news_editor" HeaderText="编辑者" SortExpression="news_editor" />
<asp:TemplateField HeaderText="内容">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Height="100px" Text='<%# Bind("news_content") %>'
TextMode="MultiLine" Width="450px"></asp:TextBox>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Height="100px" TextMode="MultiLine" Width="450px" Text='<%# Bind("news_content") %>'></asp:TextBox>
</InsertItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
</Fields>
<AlternatingRowStyle CssClass="row2" />
</asp:DetailsView>
</LoggedInTemplate>
</asp:LoginView>
</td>
</tr>
<tr style="font-size: 12pt; color: #000000">
<td style="height: 27px; width: 644px;">
</td>
</tr>
</table>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [news] WHERE ([news_id] = ?)"
OnInserted="SqlDataSource1_Inserted"
OnUpdated="SqlDataSource1_Updated"
DeleteCommand="DELETE FROM [news] WHERE [news_id] = ?"
InsertCommand="INSERT INTO [news] ( [news_type], [news_subject], [news_content], [news_editor]) VALUES ( ?, ?, ?, ?)"
UpdateCommand="UPDATE [news] SET [news_type] = ?, [news_date] = ?, [news_subject] = ?, [news_content] = ?, [news_editor] = ? WHERE [news_id] = ?">
<SelectParameters>
<asp:QueryStringParameter Name="news_id" QueryStringField="news_id" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="news_id" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="news_type" Type="String" />
<asp:Parameter Name="news_date" Type="DateTime" />
<asp:Parameter Name="news_subject" Type="String" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_editor" Type="String" />
<asp:Parameter Name="news_id" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="news_type" Type="String" />
<asp:Parameter Name="news_subject" Type="String" />
<asp:Parameter Name="news_content" Type="String" />
<asp:Parameter Name="news_editor" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</form>
</body>
</html>

...全文

相关推荐

asp.net2.0 新闻发布系统

一个利用Vb.net实现的新闻系统,有新闻分类、添加、评论等功能

lzs11230

***和C#入门级新闻发布系统源码解析

本文还有配套的精品资源,点击获取 简介:本系统是一个基于 和C#的简单新闻发布平台,适合初学者理解Web开发和数据库交互。源码包括新闻的增删改查操作,图片上传功能,浏览量统计,管理员登录验证等关键功能。系统使用Access数据库存储新闻数据,通过 控件和后台代码实现前后端交互。 1. 新闻发布系统简介 新闻发布系统,作为内容管理系...

懒癌弓箭手起源

ASP.NET MVC新闻发布系统实战:从数据建模到安全加固

Web开发的核心能力,从来不是某个炫技的框架特性,而是对增删改查、文件上传、富文本编辑、分页、权限控制、数据缓存等基础模块的扎实掌握。新闻发布系统作为经典的练手项目,恰好将这些技术点完整串联,堪称全栈开发的微缩样板。基于ASP.NET MVC与Entity Framework的组合,开发者能够以清晰的分层架构快速构建内容管理后台与前台展示端,同时利用SQL Server实现高效的数据存储与查询优化。这类系统在企业内部资讯平台、内容门户及毕设项目中应用广泛,其技术价值在于帮助开发者建立从数据建模到前端展示、再

鄂奎阿

ASP.NET新闻发布系统实战:从数据模型到IIS部署全解析

ASP.NET MVC作为成熟的企业级Web开发框架,在内容管理系统构建中依然占据重要地位。新闻发布系统不仅是典型的CRUD业务,更涉及数据模型设计、角色权限控制、请求体安全读取、XSS与CSRF防护等关键工程实践。通过Entity Framework实现数据持久化,利用Razor模板引擎快速构建服务端渲染页面,配合IIS部署调优,可以高效交付稳定可靠的内容管理平台。本文从技术选型出发,剖析新闻模块的状态管理、分类与权限设计、富文本过滤及上传安全等核心环节,并结合实际踩坑经验,给出从开发到部署的完整落地路径

是小鬏鬏啊

基于ASP的新闻发布系统设计与源码实现

基于ASP的新闻发布系统设计与源码实现

Sherry_shiry
评论 11
收藏 已收藏
分享
返回顶部
njuRF
C# 111,129 成员 642,540 内容