C# gridview中的验证器在jquery cookie中创建
在我的网站上,我有一个内置gridview的转发器。中继器项目位于可以展开或折叠的隐藏面板中。为了记住页面重新加载时打开的面板,我使用jquerycookie。一切正常。 对于gridview中的控件,我想使用例如asp CompareValidator。如果我在Firefox中这样做,我会看到错误 TypeError:$。cookie不是函数 在我使用的项目中: jquery.cookie.js 1.4.1和jquery-2.1.4.js 这是我的js代码:C# gridview中的验证器在jquery cookie中创建,c#,jquery,validation,gridview,cookies,C#,Jquery,Validation,Gridview,Cookies,在我的网站上,我有一个内置gridview的转发器。中继器项目位于可以展开或折叠的隐藏面板中。为了记住页面重新加载时打开的面板,我使用jquerycookie。一切正常。 对于gridview中的控件,我想使用例如asp CompareValidator。如果我在Firefox中这样做,我会看到错误 TypeError:$。cookie不是函数 在我使用的项目中: jquery.cookie.js 1.4.1和jquery-2.1.4.js 这是我的js代码: var expandCookieK
var expandCookieKey = "cookie_Expand";
function saveButtonMouseOver() {
this.focus();
}
$(function () {
$gridArray = $('.expandableGrid');
checkCookie(expandCookieKey);
});
function createExpandCookie(aiCookieKey, aiCookieValue) {
if ($.cookie(aiCookieKey) != null)
$.removeCookie(aiCookieKey);
$.cookie(aiCookieKey, aiCookieValue);
}
function checkCookie(aiCookieKey) {
if ($.cookie(aiCookieKey) != null) {
var index = $.cookie(aiCookieKey);
$($gridArray[index]).slideDown('slow');
}
}
function expandContainer(aiClickedElement) {
var $thisExpand = $(aiClickedElement).parent('.expandContainer').children('div.expandableGrid');
$gridArray
.filter(':visible')
.not($thisExpand)
.slideUp('slow');
$thisExpand.is(":visible") ? $thisExpand.slideUp('slow') : $thisExpand.slideDown('slow');
createExpandCookie(expandCookieKey, $gridArray.index($thisExpand));
}
这是我的aspx网站的一部分
<asp:Content ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
.version-hidden {
display: none;
height: auto;
padding: 10px;
}
.editTapete {
padding-top: 10px;
padding-right: 10px;
}
.header {
width: 100%;
height: 50px;
padding: 10px;
margin-bottom: 15px;
font-size: 24px;
background: #f1f1f1;
color: #000;
font-weight: bold;
border: 1px solid #dbdbdb;
}
.header .description{
margin-top: 7px;
float: right;
*right: 0px;
font-size: 12px;
font-weight: 300;
}
.expandContainer {
width: 100%;
display: block;
*min-height: 30px;
color: #fff;
padding: 5px 10px;
background: #337ab7;
overflow: auto;
border: 1px solid #dbdbdb;
}
.label {
font-size: 16px;
padding-left: 10px;
}
.expandableGrid {
display: none;
height: auto;
padding: 5px;
*margin: 15px;
color: #337ab7;
overflow: auto;
}
</style>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<div class="row"></div>
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-11">
<div class="input-group custom-panel-item" style="margin-bottom: 30px; width: 100%;" >
<div class="input-group-addon">
<span class="glyphicon glyphicon-list"></span>
</div>
<input type="text" class="form-control textbox-cursor" style="font-weight: 600; font-size: 14px;" id="invLabel" runat="server" disabled />
</div>
<asp:Repeater ID="repeater_ProjectInvestSections" SelectMethod="GetSectionsToUA" runat="server" ItemType="AWS_PV.nsPocos.nsTapete.MainGroup" OnItemCommand="repeater_ProjectInvestSections_ItemCommand">
<SeparatorTemplate>
<span style="height: 5px; background: #fff; width: 100%; display: block; position: relative;"></span>
</SeparatorTemplate>
<ItemTemplate>
<div class="expandContainer">
<span class="glyphicon glyphicon-chevron-down" style="cursor: pointer; padding-top: 10px;" onclick="expandContainer(this);"></span>
<span class="label textbox-cursor" style="display: inline-block; position: relative; height: 40px; padding-top: 10px;"><%# Item.Description %></span>
<asp:Label ID="label_HiddenSectionId" Text="<%# Item.ID %>" runat="server" Visible="false" />
<span class="btn" style="position:absolute; right:20px">
<asp:LinkButton runat="server" ID="editSection" CssClass="btn btn-default" CommandName="Edit" >
<i aria-hidden="true" class="glyphicon glyphicon-pencil"></i>
</asp:LinkButton>
</span>
<span class="btn" style="position:absolute; right:80px">
<asp:LinkButton runat="server" ID="saveSection" CssClass="btn btn-default" CommandName="Save" >
<i aria-hidden="true" class="glyphicon glyphicon-floppy-disk"></i>
</asp:LinkButton>
</span>
<div class="expandableGrid">
<asp:GridView ID="Gridview_ProjectInvest" runat="server" DataSourceID="dataSource_InvestCostsToSection" AutoGenerateColumns="false"
GridLines="Vertical" CellPadding="2" BackColor="White"
HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="Left"
ItemType="AWS_PV.nsPocos.ProjectInvestObj"
CssClass="table table-bordered table-condensed"
OnRowDataBound="Gridview_ProjectInvest_RowDataBound" ShowFooter="true" DataKeyNames="InvestID,fachgrpRef">
<Columns>
<asp:TemplateField HeaderText="Benennung" >
<ItemTemplate>
<asp:Label ID="Beschreibung" runat="server" Text='<%# Item.Beschreibung %>' />
<asp:TextBox ID="editBeschreibung" runat="server" Text='<%#Eval("Beschreibung") %>' MaxLength="255" Width="530" Visible="false" BackColor="Yellow"/>
< <asp:RequiredFieldValidator ID="valBeschreibung" runat="server" ControlToValidate="editBeschreibung"
Display="Dynamic" ErrorMessage="Eine Beschreibung ist notwendig." ForeColor="Red" SetFocusOnError="True"
ValidationGroup="editGrp">Eine Beschreibung ist notwendig.
</asp:RequiredFieldValidator>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="dataSource_InvestCostsToSection" runat="server" SelectMethod="Gridview_GetData" TypeName="Subpages.EditProject.Project" DataObjectTypeName="SP_AWS_GetInvest">
<SelectParameters>
<asp:ControlParameter ControlID="label_HiddenSectionId" Name="aiSectionId" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
.隐藏的版本{
显示:无;
高度:自动;
填充:10px;
}
editTapete先生{
填充顶部:10px;
右边填充:10px;
}
.标题{
宽度:100%;
高度:50px;
填充:10px;
边缘底部:15px;
字体大小:24px;
背景#f1f1;
颜色:#000;
字体大小:粗体;
边框:1px实心#dbdb;
}
.标题.说明{
边缘顶部:7px;
浮动:对;
*右:0px;
字体大小:12px;
字体大小:300;
}
.膨胀容器{
宽度:100%;
显示:块;
*最小高度:30px;
颜色:#fff;
填充物:5px10px;
背景#337ab7;
溢出:自动;
边框:1px实心#dbdb;
}
.标签{
字体大小:16px;
左侧填充:10px;
}
.可扩展网格{
显示:无;
高度:自动;
填充物:5px;
*利润率:15px;
颜色:#337ab7;
溢出:自动;
}
这不是一个好主意。
怎么了?
任何帮助都将不胜感激。我的问题很不清楚。但现在我找到了解决办法 您必须更改web.config,如下所示:
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/> </appSettings>
我的问题很不清楚。但现在我找到了解决办法 您必须更改web.config,如下所示:
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/> </appSettings>
请说明如何调用方法checkCookie()
您的帖子很不清楚,还请说明您在什么阶段获得的对象不支持属性或方法cookie
此错误。我已经更新了我的问题并发布了我使用的所有javascript。页面加载时出现错误。请说明如何调用方法checkCookie()
您的帖子非常不清楚,还请说明您在什么阶段获得的对象不支持属性或方法cookie
此错误。我已更新了我的问题并发布了我使用的所有javascript。页面加载时出错。虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接供参考。如果链接页面发生更改,仅链接的答案可能会无效。虽然此链接可以回答问题,但最好在此处包含答案的基本部分,并提供链接以供参考。如果链接页面发生更改,则仅链接的答案可能无效。