菜鸟问题,请各位高手帮忙!!

milizi820 2008-04-17 03:56:15
错误 1 验证 (ASP.Net): 在“UpdatePanel”元素的开始标记与结束标记之间不允许出现文本。
错误 2 元素“GridView”不是已知元素。原因可能是网站中存在编译错误。
错误 3 验证 (Internet Explorer 6): 不支持元素“columns”。

转到设计页时错误 1 创建类型时出错 类型“System.Web.UI.UpdatePanel”不具有名为“GridView”的公共属性。


已经实现好了数据绑定和分页,查询的gridview,想让它变成无刷新分页及查询,现在在gridview上加了
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode ="Always" >

 <asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="GV_PageIndexChanging">
<Columns>
<asp:TemplateField>
<ItemTemplate>
.........................
</asp:GridView>
<asp:Label ID="LabelPageInfo" runat="server"></asp:Label>
</asp:UpdatePanel>
...全文
534 33 打赏 收藏 转发到动态 举报
写回复
用AI写文章
33 条回复
切换为时间正序
请发表友善的回复…
发表回复
milizi820 2008-04-18
  • 打赏
  • 举报
回复
可以了,哈哈,
自己真的好菜鸟噢,,
不过会继续努力~~
谢谢大家的热心帮助
tanyuanxu 2008-04-17
  • 打赏
  • 举报
回复
你的updatepanl都設置成了UpdateMode ="Always",在這里的情況跟你沒有加updatepanel控件一樣的
你要把它的updatemode設置成conditional,并且要設置updatepanel的trrigers讓它的sub_control來觸發updatepanel更新(當需要更新的時候)
oec2003 2008-04-17
  • 打赏
  • 举报
回复
UpdatePanel2 不用添加


添加红字部分


<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode ="Conditional" >

<Triggers >
<asp:AsyncPostBackTrigger ControlID ="ButtonQuery" />
</Triggers>

<ContentTemplate>
<asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="GV_PageIndexChanging" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="False" Visible="True" runat="server">
</asp:CheckBox> </ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="BookId" HeaderText="编号" />
<asp:BoundField DataField="BookName" HeaderText="图书名" />
<asp:BoundField DataField="Author" HeaderText="作者" />
<asp:BoundField DataField="Publisher" HeaderText="出版社" />
<asp:BoundField DataField="PublishDate" HeaderText="出版日期" DataFormatString="{0:yyyy-MM-dd}" />
<asp:BoundField DataField="Price" HeaderText="价格" DataFormatString="{0:C}" />
<asp:HyperLinkField HeaderText="详细信息" DataTextFormatString="详细信息" Text="详细信息" DataNavigateUrlFormatString="BookDetail.aspx?book_id={0}"
DataNavigateUrlFields="BookId" />
</Columns>
</asp:GridView>
<asp:Label ID="LabelPageInfo" runat="server"> </asp:Label>
</ContentTemplate>
</asp:UpdatePanel>




milizi820 2008-04-17
  • 打赏
  • 举报
回复
谁教我弄下啊?实现 无刷新查询
叶子 2008-04-17
  • 打赏
  • 举报
回复
学习了
wqzj 2008-04-17
  • 打赏
  • 举报
回复
学习了,好东西收集
milizi820 2008-04-17
  • 打赏
  • 举报
回复
[Quote=引用 26 楼 mylibin 的回复:]
在查询的地方放个无刷新控件
[/Quote]
<td style="height: 21px; width: 52px;">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode ="conditional" >
<ContentTemplate >
<asp:Button ID="ButtonQuery" runat="server" Text="查询" Width="48px" OnClick="ButtonQuery_Click">
</asp:Button>
</ContentTemplate>
</asp:UpdatePanel>
</td>

我加了,但运行后,点击 查询 按纽 没反应。。
我把无刷新控件改放下面的位置后,点查询 按纽,有反应,但没有实现无刷新的效果
<tr >
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode ="conditional" >
<ContentTemplate >

<td colspan="1" rowspan="1" style="height: 21px">
※书名:
<asp:TextBox ID="TextBoxBookName" runat="server Width="66px"> </asp:TextBox>
...............................
<td style="height: 21px; width: 52px;">
<asp:Button ID="ButtonQuery" runat="server" Text="查询" Width="48px" OnClick="ButtonQuery_Click">
</asp:Button> </td>
</ContentTemplate>
</asp:UpdatePanel>

</tr>
mylibin 2008-04-17
  • 打赏
  • 举报
回复
在查询的地方放个无刷新控件
milizi820 2008-04-17
  • 打赏
  • 举报
回复
<tr >
<td colspan="1" rowspan="1" style="height: 21px">
※书名:
<asp:TextBox ID="TextBoxBookName" runat="server Width="66px"></asp:TextBox></td>
<td style="height: 21px" colspan="1" rowspan="1">
※类别:
<asp:DropDownList ID="DropDownListCategory" runat="server">
</asp:DropDownList></td>
<td style="height: 21px">
※排序:
<asp:DropDownList ID="DropDownListSortColumn" runat="server">
'''''''''
..........
</asp:DropDownList>
<asp:DropDownList ID="DropDownListSortType" runat="server">
<asp:ListItem Value="Desc">递减</asp:ListItem>
<asp:ListItem Value="Asc">递增</asp:ListItem>
</asp:DropDownList></td>
<td style="height: 21px; width: 52px;">
<asp:Button ID="ButtonQuery" runat="server" Text="查询" Width="48px" OnClick="ButtonQuery_Click">
</asp:Button></td>
</tr>
<tr>
<td align="center" colspan="4">
<br>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode ="Conditional" > <ContentTemplate>
 <asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="GV_PageIndexChanging"
>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="False" Visible="True" runat="server">
</asp:CheckBox></ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="BookId" HeaderText="编号" />
<asp:BoundField DataField="BookName" HeaderText="图书名" />
<asp:BoundField DataField="Author" HeaderText="作者" />
<asp:BoundField DataField="Publisher" HeaderText="出版社" />
<asp:BoundField DataField="PublishDate" HeaderText="出版日期" DataFormatString="{0:yyyy-MM-dd}" />
<asp:BoundField DataField="Price" HeaderText="价格" DataFormatString="{0:C}" />
<asp:HyperLinkField HeaderText="详细信息" DataTextFormatString="详细信息" Text="详细信息" DataNavigateUrlFormatString="BookDetail.aspx?book_id={0}"
DataNavigateUrlFields="BookId" />
</Columns>
</asp:GridView>
<asp:Label ID="LabelPageInfo" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>

</td>
</tr>
milizi820 2008-04-17
  • 打赏
  • 举报
回复
谢谢virusplayer,谢谢大家啊!!
我把virusplayer 的代码粘贴webconfig里后,现在可以实现无刷新分页了,,谢谢啊
但是点查询还是会刷新,我还想实现查询也无刷新
怎么弄?
milizi820 2008-04-17
  • 打赏
  • 举报
回复
你是创建的普通网站,然后添加的ScriptManager 和UpdatePanel 吗
那你的webconfig文件没有添加下面这些东西,如果是创建的ajax网站就不用自己添加了,要保证ScriptManager 是第一个添加的控件,


对啊,我是以前做好了的,现在想在这个地方改成无刷新(创建的普通网站)
那我现在只可以通过改webconfig来实现吗
shmilyatouer 2008-04-17
  • 打赏
  • 举报
回复
飘过!
chenguang79 2008-04-17
  • 打赏
  • 举报
回复
楼主的代码中没能<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> 啊
sun_Ke 2008-04-17
  • 打赏
  • 举报
回复
无刷新用ajax做
virusswb 2008-04-17
  • 打赏
  • 举报
回复
你是创建的普通网站,然后添加的ScriptManager 和UpdatePanel 吗
那你的webconfig文件没有添加下面这些东西,如果是创建的ajax网站就不用自己添加了,要保证ScriptManager 是第一个添加的控件,
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>

<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>

<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>

<system.web.extensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->

<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>

<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
</configuration>

这样就可以了,最好创建ajax网站,可以省去很多麻烦那
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="CustomerID" DataSourceID="SqlDataSource1">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True" SortExpression="CustomerID" />
<asp:BoundField DataField="CompanyName" HeaderText="CompanyName" SortExpression="CompanyName" />
<asp:BoundField DataField="ContactName" HeaderText="ContactName" SortExpression="ContactName" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [CustomerID], [CompanyName], [ContactName] FROM [Customers]">
</asp:SqlDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
Ischema 2008-04-17
  • 打赏
  • 举报
回复
帮顶
milizi820 2008-04-17
  • 打赏
  • 举报
回复
现在的情况是,,我运行页面还是可以,但是没效果
还是会刷新
跟没加一样,
是怎么回事啊??
milizi820 2008-04-17
  • 打赏
  • 举报
回复
<td align="center" colspan="4">
<br>

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode ="Conditional" >
<ContentTemplate>
 <asp:GridView ID="GV" runat="server" AutoGenerateColumns="False" AllowPaging="True" OnPageIndexChanging="GV_PageIndexChanging"
>
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chk" Checked="False" Visible="True" runat="server">
</asp:CheckBox></ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="BookId" HeaderText="编号" />
<asp:BoundField DataField="BookName" HeaderText="图书名" />
<asp:BoundField DataField="Author" HeaderText="作者" />
<asp:BoundField DataField="Publisher" HeaderText="出版社" />
<asp:BoundField DataField="PublishDate" HeaderText="出版日期" DataFormatString="{0:yyyy-MM-dd}" />
<asp:BoundField DataField="Price" HeaderText="价格" DataFormatString="{0:C}" />
<asp:HyperLinkField HeaderText="详细信息" DataTextFormatString="详细信息" Text="详细信息" DataNavigateUrlFormatString="BookDetail.aspx?book_id={0}"
DataNavigateUrlFields="BookId" />
</Columns>
</asp:GridView>
<asp:Label ID="LabelPageInfo" runat="server"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>

</td>
milizi820 2008-04-17
  • 打赏
  • 举报
回复
<ajaxToolkit:UpdatePanelAnimationExtender runat="server" TargetControlID="updatePanel">
<Animations>
<OnUpdating>
<Parallel duration="0">
<%-- place the update progress div over the gridview control --%>
<ScriptAction Script="onUpdating();" />
</Parallel>
</OnUpdating>
<OnUpdated>
<Parallel duration="0">
<%--find the update progress div and place it over the gridview control--%>
<ScriptAction Script="onUpdated();" />
</Parallel>
</OnUpdated>
</Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>


我这没有ajaxToolkit: 出来

mylibin 2008-04-17
  • 打赏
  • 举报
回复
肯定有这个<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

不然的话报的就不是上面的错误了
你把代码帖出来 看看
加载更多回复(13)

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧